Find Page Elements In Chrome With XPATH

Sometimes, the test automation of a site needs to be done in Chrome instead of Firefox.

This may be because the site works better (or only) in Chrome or because the site needs to be tested on multiple browsers.

How can site elements be found with XPATH in Chrome?

Firefox has the FireBug and FirePath plugins that help greatly with the XPATH expressions.

But there are no good equivalent browser extensions for Chrome (or I have not found them yet).

So what to do in Chrome?

The Chrome Developer Tools are the solution.

See below the steps to take:

1. click on the browser menu 
2. click Tools
3. click Developer Tools



4. click the CONSOLE tab



5. type the following in the Console tab:

$x("xpath expression")




Enjoy!



_____________________________________________________________________________


Do you want to learn more about test automation and Java?
I will start an SELENIUM online group training on October 15.
Please see the training details here.

Share this