Skip to main content

Below are the difference between absolute and Relative XPath:

Point of Difference Absolute Path Relative Path
Starts with Single Forward Slash. Select the element from the root <html> and cover the whole path to the element. It is also known as complete or Full Xpath. Double Forward Slash. Expression can starts in the middle of the HTML DOM structure.
Speed Faster. It identify the element very fast. Slower compare to absolute. it will take more time in identifying the element as we specify the partial path not (exact path).
Failure Chances More. It Changes Frequently, if there are any changes made in the path of the element then XPath gets failed. Failure chance of well written relative path is very less


if any tag will be added before table the path will fail.


Doesn't matter if anything added before table.

Chrome gives you option to select full XPATH and relative XPATH, For example this is the examples of Logo of website

#full XPATH by chrome

#Relative XPATH by Chrome

#We can further shorten this path like this
//img[@alt='My Store']

All path will find the same element but the last one is shorter and efficient one and failure chances of it are comparatively less then previous two.

Video Tutorial


Elix is a premium wordpress theme for portfolio, freelancer, design agencies and a wide range of other design institutions.