This can be achieved by three different approaches (see my blog article here for more details):
Elements
panel like below$x()
and $$()
in Console
panel, as shown in Lawrence's answerHere is how you search XPath in Elements
panel:
Since FF 75 it's possible to use raw xpath query without evaluation xpath expressions, see documentation for more info.
In the command line at the bottom use the following:
$()
: Returns the first element that matches. Equivalent to document.querySelector()
or calls the $
function in the page, if it exists.
$$()
: Returns an array of DOM nodes that match. This is like for document.querySelectorAll()
, but returns an array instead of a NodeList
.
$x()
: Evaluates an XPath expression and returns an array of matching nodes.