How To Find Xpath In Google Chrome

XPath or XML Path Language is a query language used for selecting nodes from an XML document. It is commonly used in web scraping to retrieve data from web pages. Luckily, if you are using Google Chrome, locating the XPath of an element on a web page is a relatively simple task. This thorough guide will take you step by step through the process.

Steps to Find XPath in Google Chrome

Follow the steps below to get the XPath of an element:

  1. Open Google Chrome and navigate to the respective webpage.
  2. Ensure that the website page you are interested in is open in your Google Chrome browser.

  3. Right-click on the element of interest and select ‘Inspect’.
  4. This will open the browser’s Developer Tools. Here, you will find the ‘Elements’ panel which displays the HTML structure of the web page.

  5. In the ‘Elements’ panel, right-click on the highlighted code corresponding to the element of interest.
  6. When you inspect an element, the corresponding HTML code gets highlighted in the ‘Elements’ panel. To find the XPath, right-click on this highlighted code.

  7. Select ‘Copy’ > ‘Copy XPath’.
  8. This action copies the XPath of the selected element to your clipboard. You can now use this XPath in your web scraping project or wherever you need it.


For example, let’s say we want to find the XPath of the search box on Google’s homepage.

Right-click on the search box and select ‘Inspect’. In the ‘Elements’ panel, the code corresponding to the search box will be highlighted. Right-click on this highlighted code and select ‘Copy’ > ‘Copy XPath’.

The copied XPath will look something like this:



Finding XPath in Google Chrome is a straightforward task and a great skill to have in your arsenal, especially if you’re into web development or web scraping. With Google Chrome’s robust developer tools, you can easily find the XPath of any element on a web page. Just remember to use this information responsibly and respect the privacy and terms of use of the websites you are dealing with.