Tool to generate XPath

Question:

Hi, I'm making a spider to XPath capture some data from the web.

However, the creation of xpath is a little laborious. Does anyone know any way to train XPath? Example; I click 5 times on a link and some tool generates the xpath.

Any tip is welcome.

Thanks!

Answer:

I compiled the answers found here:

https://stackoverflow.com/questions/3030487/is-there-a-way-to-get-the-xpath-in-google-chrome

"Chrome Dev Tools"

When using "Chrome Dev Tools" (You can access by right clicking on some element and ask to "inspect element") you can right click on the element, then "Copy XPath".

Add-on for Chrome.

https://chrome.google.com/webstore/detail/xpath-helper/hgimnogjllphhhkhlmebbmlgjoejdpjl

Javascript console

You can also use $x in Chrome's javascript console.

ex: $x("//img")

XPather

I didn't get to test it, but this tool apparently seems to be what you want.

XPather

Scroll to Top