Scroll to the next instance of "TEXT HERE" and click it

Hi everybody,
I hope you can help:
I am trying to let the macro find a text on the page using xpath=//*[text()[contains(.,‘TEXT HERE’)]] and click it. The find works, but I want the macro to click the text (link) and scroll to the next instance if the same text.
If I loop the command and if I manually scroll, it works but not automatically.
How can I let the macro scroll to the next instance and click and the next and click ect.

Many thanks for your help.

Best Regards,
Markus

Your solution was very close, simply add [6] if you need e. g. the 6th match :wink:

See also: FAQ: How can I find the n-th link with a specific text?

Demo macro - here we click the first and the 6th 7Zip download link:

{
  "Name": "xpath text",
  "CreationDate": "2023-2-5",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://www.7-zip.org/download.html",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "xpath=(//a[text()='Download'])[1]",
      "Value": "",
      "Description": "First Download link"
    },
    {
      "Command": "click",
      "Target": "xpath=(//a[text()='Download'])[6]",
      "Value": "",
      "Description": "6th Download link!!!"
    },
    {
      "Command": "click",
      "Target": "xpath=(//*[text()='Download'])[8]",
      "Value": "",
      "Description": "no *a* - So this searches for the text in any element and not just links (not recommended here)"
    }
  ]
}

Many thanks. Now it works.