Join 500+ Software Testing professionals. Solve problem and get your problem solved. Register Now!

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

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

1 Answer

1
Best 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 by (151 points)
selected by
...