1.

In Xpath, what is the difference between "/" and "//"?

Answer»

Single Slash "/" - A single slash is used to CREATE an XPATH with an absolute PATH, i.e. the XPath will begin with the document node/start node.

For example, 

Absolute XPath: /html/body/div/div/form/input

Here, /html is the root html node.

Double Slash "//" - The double slash is used to CONSTRUCT an Xpath with a relative path, which means the XPath can start selection from anywhere on the page.

For example,

Relative XPath: //input[@id = 'email']

Here, we can LOCATE an input having id = ‘email’ present anywhere in the document object model (DOM).



Discussion

No Comment Found