Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get DOM element Xpath in Firefox

It might be just me but I can't find any way to get DOM element's XPATH in Firefox.

That was possible in Firebug, but now it's deprecated in favor of Firefox Developer Tools, and the recommendation is not to use it any longer.

So, is there any way to get XPATH in Firefox and its Developer Tools?

like image 489
Oleg Mikheev Avatar asked Jan 06 '17 03:01

Oleg Mikheev


People also ask

How do I get XPath element in Firefox?

Right click on an element of the page. Right click highlighted element. Select: "Copy XPath"


1 Answers

Open the developer tools in Firefox, then:

  1. Click on Console tab.
  2. Type allow paste if you are pasting anything.
  3. Type the XPath like so:

    $x("path")
    

    For example:

    $x(".//*[@id='4th']/tbody/tr[1]/td")
    

Firebug also works well, so I suggest using that instead.

like image 65
Alvin Bunk Avatar answered Oct 28 '22 16:10

Alvin Bunk