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

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


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


Right click on the node => "Copy XPath"


All above answers are correct here is another way with screenshot too.

From Chrome :

  1. Right click "inspect" on the item you are trying to find the xpath
  2. Right click on the highlighted area on the console.
  3. Go to Copy xpath

enter image description here