Is it possible to get the XPath of an element with the Firefox "inspect element" function (Q)?

The Chrome inspector can do this, but if I use the "Copy Unique Selector" option with Firefox's inspector, I get a selector in a different format, not XPath.

I know there are extensions, but is it possible without extensions?

3 Answers 3


It is possible, but I doubt if anyone would try it more than a couple of times

Copy the unique selector

Open Scratchpad

Switch environment to browser

Paste the following snippet

XPathGenerator.generate(content.document.querySelector("unique selector placeholder"));

Paste the unique selector then form the Execute menu select Display


I know this question is old, but this feature now exists in the Developer tools of Firefox Quantum.

After inspecting, you can right-click the tag and Copy->XPath:

enter image description here


You can use Firebug extension on Firefox to get xpath expression. Chrome Inspector or firebug do not generate more accurate xpath which are based on attributes like Class, ID or related attributes, example below


So in that cause you can use some kind of xpath expression generator tools like http://webdata-scraping.com/xpath-generator/

Which has point and click user interface to generate different types of Xpaths.

  • Thanks for that link to XPath Generator. It's frustrating that the descendant of FireBug doesn't support generation of XPaths in Firefox, so that tool is a helpful replacement for that functionality.
    – NewSites
    Aug 16, 2017 at 18:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .