Register now or log in to join your professional community.
Absolute path uses complete path from root element to the desired element.
Relative path start by referencing the element we want and go from there till desired element.
A Relative URL is a the path to a file relative to the current location. If the file is in the same location as you are in you can just write it’s file name – extension included.
An Absolute URL is a full path to the file. It can be accessed from anywhere on the web, from any site as it provides the full address
Absolute XPath Absolute XPath starts with the root node or a forward slash (/).
Advantage:
•identifies the element very fast.Disadvantage:
•Some other tag added in between Absolute path will no longer works.
Example:1. html/head/body/table/tbody/tr/th
Relative Xpath: A relative XPath is one where the path starts from the node of your choice - it doesn't need to start from the root node.
•It starts with Double forward slash(//)Syntax: //table/tbody/tr/th
Advantage:
•Don't need to mention the long xpath.
Absolute path is the full directory path from the root folder.For Ex: in Windows -> C:\\ABC\\test.xlsIn Linux -> //var/test.xlsRelative path is the relative to the present directory you are present in.For Ex: In windows: ..\\folder\\test.xlsIn Linux: ../test.xls We generally use relative path as it defines the path from current directoryAbsolute path we are not providing because its from root. so might be possibility that the folder which exists in my machine is not exists in other machines.