Tech
XPath in Firefox: Console Shortcuts, JavaScript API, DevTools Inspector, and Selenium Integration
XPath (XML Path Language) is a query language for selecting nodes in XML/HTML documents. Firefox has XPath support both in JavaScript and as a built-in DevTools feature. Here's how to use it.
XPath in Firefox DevTools Console
Firefox DevTools Console has a built-in $x() function that evaluates XPath against the current page:
// Find all h2 elements
$x ( ' //h2 ' )
// Find elements with a specific attribute
$x ( ' //*[@class="highlighted"] ' )
// Fin...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to