absolute xpath and relative expath code example

Example: relative vs absolute xpath

Single Slash “/” is used to create XPath with absolute path 
Double Slash “//” is used to create XPath with relative path 
Xpath stands for XML path
-Absolute Xpath: is a direct way to locate an element and
it uses Complete path.

-On the other hand

Relative Xpath: starts from the middle of the
HTML DOM and You can find unique parent node
and simply start from there to element you want. 
Less fragile. Shorter. Never fails to
identify object even though object’s
location changes. It is written directly from
the Web Element using Web Element attribute


Syntax = //tagname[@attribute='value']

Tags:

Misc Example