0 votes
in Selenium by
In Xpath, what is the difference between "/" and "//"?

1 Answer

0 votes
by

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).

...