4

I used to use FirePath and FireBug for XPath support in Firefox a long time ago, but those tools haven't worked with Firefox for some time. I was disappointed but found that I could still use the find feature in the inspector developer tool to look up elements. Today however (with Quantum 65.0.1, x64), I found it does not work anymore. See the //div search in the find box, highlighted in dark red:

Firefox doesn't find divs by XPath

I checked the developer tools settings and found nothing related to XPath search. I can still right-click an element and Copy its XPath. Is there anything I can do to search by XPath in Firefox these days?

nikodaemus
  • 2,883

2 Answers2

5

Searching elements by XPath within the DevTools Inspector is only available since Firefox 75. See bug 963933 for more information.

Note that you can also search elemnets by XPath using the command $x() in the console, or use the add-on Try XPath.

0

In newer version of Firefox it's direct. Tested on v104.0.2

For instance, open up example.com

Example.com

Open the inspector and type-in //html/p in the top bar and press Enter. You get the first <p> immediately selected:

html p

Press Enter again and it'll loop over the search results. So it'll select the next <p> and so on.