Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

What is the difference between Absolute path & Relative path?

user-image
Question added by Anilkumar Bonchervu
Date Posted: 2015/02/09

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.

 

Pakki Satish Patnaik
by Pakki Satish Patnaik , Value Banker(senior officer) , Icici bank

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

Mohd Shoeb
by Mohd Shoeb , Test Engineer , Motorola Solutions India Pvt Ltd

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.

Ajay Gupta
by Ajay Gupta , Associate Software Engineer , IBM

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.

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.