What is the difference between relative and absolute XPath?

0 votes
I was using XPath for locating an element and came to know there are two kinds of XPath. Can someone help me distinguish between them and tell me as which of the two is better for testing purpose?
Dec 19, 2018 in Selenium by Jino
• 5,560 points
395 views

1 answer to this question.

0 votes

Absolute Xpath: It contains the complete path from the Root Element to the desire element.

Relative Xpath: This is more like starting simply by referencing the element you want and go from the particular location.

You use always the Relative Path for testing of an element. The reason behind that is if you make any architectural change in the website the change won't effect the testing or selecting of the element.

Hope this information was what you were looking for.

answered Dec 19, 2018 by Nabarupa

Related Questions In Selenium

0 votes
1 answer

What is the difference between dot and text() in XPath?

Even though there is some difference between ...READ MORE

answered Apr 25, 2018 in Selenium by king_kenny
• 3,650 points
1,200 views
0 votes
1 answer

What is the primary difference between the XPath and CSS selector?

Hello Ushma, the primary difference between XPath ...READ MORE

answered Jun 23 in Selenium by Anvi
• 12,860 points
570 views
0 votes
1 answer

What is the difference between thoughtworks.selenium and openqa.selenium selenium?

thoughtworks.selenium is the original Selenium (aka Selenium 1, ...READ MORE

answered Apr 13, 2018 in Selenium by king_kenny
• 3,650 points
186 views
0 votes
1 answer

What is difference the between Selenium and Celerity?

If you are talking about speed, use Celerity. If ...READ MORE

answered Apr 20, 2018 in Selenium by king_kenny
• 3,650 points
59 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,090 points
592 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
901 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
578 views
0 votes
2 answers
0 votes
1 answer

What is the difference between test scenarios, test cases and test script?

Difference between test scenarios and test cases ...READ MORE

answered Jan 28 in Selenium by Frankie
• 9,810 points
142 views