eeadev
eeadev

Reputation: 3852

How to get Absolute XPath in Chrome or Firefox?

As written in the question I need the absolute Xpath and not the relative one.

I mean, I need something like this:

html/body/div[1]/section/div[1]/div/div/div/div[1]/div/div/div/div/div[3]/div[1]/div/h4[1]/b

and not like this:

//*[@class='featured-box']//*[text()='Testing']

On both browsers when I inspect the code and I use right click -> copy XPath I am getting the relative Path.

Please note, I am using Firefox Quantum and I cannot use firebug or firepath because they are not supported.

Upvotes: 1

Views: 8213

Answers (2)

Madhuri Surapathi
Madhuri Surapathi

Reputation: 11

In chrome,for relative Xpath we use "Copy as Xpath" and for absolute Xpath use "Copy as full Xpath"

Upvotes: 1

Rafael
Rafael

Reputation: 974

Download this chrome extension: https://chrome.google.com/webstore/detail/xpath-helper/hgimnogjllphhhkhlmebbmlgjoejdpjl

After that, click at icon of the extension and, after two boxes appers in the tab window, hold shift key to navigate between elements and see the xpath.

Upvotes: 1

Related Questions