Xpath multiple elements with same text how choice an element?


Sometime i use the xpath with a text to detect some elements in the page

I use this command

XPath //*[text()[contains(.,‘General Web Automation’)]]

Now i want to know how i can choice an element if in the page there are multiple elements with the same text in this case “General Web Automation”.

If in a page there are 5 times the text “General Web Automation” and i need to detect the 3° third element how i can edit the xpath ?


Not sure it’ll work, but try like this

XPath //*[text()[contains(.,‘General Web Automation’)]][3]

1 Like

I tried it but it seems not to work

I don’t know. Works for me. Have a look.

  "Command": "open",
  "Target": "https://rarlab.com/download.htm",
  "Value": ""
  "Command": "click",
  "Target": "xpath=(//*[text()[contains(.,'RAR 5.71')]])[5]",
  "Value": ""

Hi, today I retry your code and inform you about the result.