1
What is the difference between a single and double slash used in XPath?

Closed 1 Answers 1085 Views
What is the difference between a single and double slash used in XPath?
closed with the note: Got it, sir

1 Answer

1

Usually absolute xpath starts with single slash. When use use absolute xpath, you will be covering whole path to the element.

Relative xpath starts with double slash. In that case you will be first finding unique parent node and path from there to the element.

 

E.g. If you want to identify logo if this page, there are two ways you can do that.

Absolute xpath = /html/body/div[2]/div[1]/div[1]/a

Relative xpath = //div[class="qa-logo"]/a

Hope that helps!

answered Nov 29, 2016 by stbadmin (4,970 points)
...