Is there a way to get the XPath in Google Chrome?

GeoffreyF67 picture GeoffreyF67 · Jun 13, 2010 · Viewed 480.7k times · Source

I have a webpage I want to use with YQL. But I need the XPath of a specific item. I can see it in the debug tools area for Google Chrome but I don't see a way to copy that XPath.

Is there a way to copy a full XPath?

Answer

Matt Polito picture Matt Polito · Aug 29, 2011

You can use $x in the Chrome javascript console. No extensions needed.

ex: $x("//img")

Also the search box in the web inspector will accept xpath