How to verify an XPath expression in Chrome Developers tool or Firefox's Firebug?

SeleniumAutomation TestingTesting Tools

We can verify an xpath expression in Chrome Developer tool or with Firefox Firebug. We can open the Developer tool in Chrome by pressing F12, then the Console tab is to be selected. We can validate the xpath with the $x("<xpath value>") expression.

On clicking Enter after entering the expression, an array of matching elements will be displayed. On hovering over the returned result, the actual element gets highlighted on the page. If there are no matching elements, an empty array shall be returned.

We also verify the xpath expression from the Firefox’s Firebug. First of all, we have to install the extensions Firebug and FirePath and then restart the Firefox browser. Then click on F12 to open the Developer Tool. Now we have to move to the FirePath panel. A dropdown with options xpath and css shall be available. We can validate the xpath expression there.

Please note this plugin may not be available to the latest Firefox versions.

raja
Published on 26-Oct-2020 10:30:57
Advertisements