Debugging xpath in the browser

Peter Marshall · September 22, 2020

Getting automation test failures this morning. So given some Xpath to find an element, how can I verify that the xpath works on the page. The answer is provided in Yi Zeng’s Blog.

Bring up the dev tools in the browser. If you are on the elements pannel, just type in the xpath in the search pannel. From the console wrap the xpath in $s(“somexpath”).

Interestingly this can also be used for css.

Twitter, Facebook