Menu

How to get the XPath in Chrome Browser

July 27, 2017 - HTML

So you need an XPath for your script or scraper and you have Chrome installed. No problem! Just follow these two steps and you will have your XPath ready.

Right click on the chosen element in the browser and select Inspect

Inspect Element in Chrome

Right click on the element in the Elements tab and select Copy > Copy XPath

XPath in Chrome

Here is an example XPath:

//*[@id="topics_nav"]/div[1]
//ul[contains(@class, "alphabet")]/li
//*[@id="header"]/nav/ul/li