How do I search with XPath in Firefox Quantum 65?
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.
Related videos on Youtube
skia.heliou
I am a software developer in the Detroit metro area. I specialize in Java, HTML, and CSS.
Updated on September 18, 2022Comments
-
skia.heliou over 1 year
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: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?
-
skia.heliou about 5 yearsGood reminder about
$x()
. Not as convenient as just typingCtrl + F
, but it works -
MarkHu about 4 yearsThe ticket was finally fixed in 2020q1. The search field is at the top of Firefox's Developer Tools, not in the middle like Chrome. The XPATH locator log is not quite as powerful as Chrome, for instance subscripted arrays don't seem to work.
-
Sebastian Zartner about 4 years@MarkHu Yes, and it was me that implemented it because I was also missing this feature for quite some time. I am wondering what you mean by "subscripted arrays", though. If you can provide an example and file a bug for it, I might have a look and see if that can be added. For what it's worth, I've filed the follow-up bug 1620049 to add an autocompletion to the feature.
-
MarkHu almost 4 yearsInstead of subscripted arrays, maybe I should have said, "indexed elements." Example:
(//div)[4]
found the 4thdiv
element in XPATH and Chrome's DevTools, but not Firefox [yet!] for some reason. -
Sebastian Zartner almost 4 yearsThe reason for that is that the string entered into the search field currently needs to start with a slash in order to trigger the XPath search. I have filed bug 1635970 to lift that restriction. Thank you for the hint, @MarkHu!
-
Sebastian Zartner almost 4 yearsI have also updated my answer now to note that the feature got implemented in the meantime.
-
Sebastian Zartner almost 4 years@MarkHu For your information, I have created a patch for the aforementioned bug report which landed two days ago. With that change, the full feature set of XPath expressions is supported in the search field.