0

I am trying to find out the XPATH. I am getting 30 matches for an element.

I tried using last(), position(), indexing[], child, parent, following:siblings, preceding:siblings, absolute XPATH is also not working, how to achieve this.

3
  • 1
    What have you tried so far as code, show the code and the html and not with a screenshot. Jun 5, 2019 at 10:09
  • //span[@class='cursor']//*[local-name()='svg'][@class='excel-document'][1]
    – jay
    Jun 5, 2019 at 11:24
  • //span[@class='cursor']//*[local-name()='svg'][@class='excel-document']/following::sibling::*
    – jay
    Jun 5, 2019 at 11:25

2 Answers 2

2

You're on the right track, but I've only recently discovered myself the solution to this type of problem. Surround the main xpath with parenthesis, place the subscript AFTER.

Assuming that your basic xpath is correct, the following should isolate element 1:

(//span[@class='cursor']//*[local-name()='svg'][@class='excel-document'])[1]
1
  • Thanks so much.
    – jay
    Jun 6, 2019 at 5:37
0

Absolute xpath:

html/body/div[1]/section/div[1]/div/div/div/div[1]/div/div/div/div/div[3]/div[1]/div/h4[1]/b

Relative xpath:

//*[@class='featured-box']//*[text()='Testing']

Might be the syntax you are using is wrong

1
  • Thanks, It was answered by Bill
    – jay
    Jun 11, 2019 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.