To use Wicked Good XPath, simply download the wgxpath.install.js file and include it on your webpage with a script tag. For example:
Despite the growing popularity of CSS selectors, XPath remains a useful mechanism to locate elements in an HTML document. It has particularly heavy usage in the context of frontend web testing tools like Selenium and Web Puppeteer. Sometimes there is simply no way to reference an element on the page other than with an XPath expression.
For those who have never used XPath, here is a taste:
On a Google search results page, the XPath expression //li[@class=”g”] identifies the third search result. Here is a snapshot from the Chrome extension XPath Viewer showing the third result selected when that expression is used.
We would like to thank our two Google interns, Michael Zhou and Evan Thomas, for doing the bulk of the development on this project.
By Greg Dennis and Joon Lee, Google Engineers