Skip to content

Make Selenium Easy

And Keep It That Way

  • Home
  • Share
  • Toggle search form

Tools To Find XPath In Chrome Browser

Posted on 03/21/2025 By admin

Hello Folks,

We have seen tools to find XPath in Firefox. Those tools were specific to Firefox browser.

In this post, we will learn tools to find XPath in Chrome browser.

Finding XPath without any tools:

You can find XPath and CSS selector of any web element in chrome browser without any tools as well. Let’s learn how.

Steps to find XPath or CSS selector:

  1. Open Chrome browser.
  2. Open Flipkart URL.
  3. Right click on Flipkart logo and inspect it. IT will highlight html code of web element.
  4. Mouse hover on ‘Copy’. You will see two options:
    1. Copy selector: It will give you CSS selector.
    2. Copy XPath: It will give you XPath.

It will give you below paths:

  1. CSS Path: #container > div > header > div._1tz-RS > div.Y5-ZPI > div > div > div._2OJxl5 > a > img
  2. XPath: //*[@id=”container”]/div/header/div[1]/div[2]/div/div/div[1]/a/img

But above paths are lengthy and less stable.

Finding XPath with tools:

XPath Helper:

It is an extension of Chrome browser which makes it easy to extract, edit, and evaluate XPath queries on any webpage.

Installation of XPath helper:

Step 1: Open chrome browser.

Step 2: Type “chrome://extensions/” in address bar and press ‘Enter’.

Step 3: Click on ‘Get More Extension’ link. (It will be in down of page)

Step 4: Type ‘XPath helper’ in search box.

Step 5: Click on ‘ADD TO CHROME’.

Step 6: Click on “Add extension”.

Step 7: Restart chrome browser.

After step 7, you should get an icon as shown below:

How to use XPath Helper:

Step 1: Hit Ctrl-Shift-X (or Command-Shift-X on OS X), or click the XPath Helper button
in the toolbar, to open the XPath Helper console.

Step 2: Hold down Shift as you mouse over elements on the page. The query box will continuously update to show the XPath query for the element below the mouse pointer, and the results box will show the results for the current query.

Step 3: If desired, edit the XPath query directly in the console. The results box will immediately reflect your changes.

Step 4: Repeat step 1 to close the console.

Notes:

1. If the console gets in your way, hold down Shift and then move your mouse over it; it will move to the opposite side of the page.

2. When rendering HTML tables, Chrome inserts artificial tags into the DOM, which will consequently show up in queries extracted by this extension. So while using it, we need to remove that.

We notice that XPath helper gives absolute XPath which is not good as any change in DOM structure will effect this badly. So, it is not so useful for us.

Relative XPath Helper:

It is also an extension of Chrome browser and developed by an Indian named Syam Sasi.

Installation of XPath Helper:

Just follow installation steps of XPath helper. Just search ‘Relative XPath Helper’ instead of ‘XPath helper’.

You will get an icon of Relative XPath Helper as shown below:

How to use XPath helper:

This tools is very useful when you need to find XPath of one web element with reference of another web element. Like we have concept of independent and dependent in XPath expression.

To find the XPath of single web element:

Step 1: Click on icon of Relative XPath helper.

Step 2: Right click on web element.

Step 3: Right click on same web element again. By clicking second time on same webe lement, it will give final result. In final result it will append “/self::“.

Step 4: Just remove “/self::” from final result and you can use it.

To find XPath of first web element(dependent) to second web element(independent):

Step 1: Click on icon of Relative XPath helper.

Step 2: Right Click on dependent web element first.

Step 3: Right click on independent web element.

Step 4: Final result is ready.

Note: You need to be careful as sometimes, it uses web element attribute which is dynamic. As in above example class value is dynamic. You should change it to proper attribute.

That’s it. I think it should be very clear to you. If you have any doubt, feel free to ask me always.

If you like my posts, please like, comment and share. Feedback and suggestion are always welcomed.

Thank You!!

#HappyLearning

Uncategorized

Post navigation

Previous Post: REST Assured Tutorial 49 – How To Retrieve Single and MultiValue Headers From Response Using Rest Assured
Next Post: putIfAbsent() – A Method Of Map Interface In Java

Related Posts

September 23, 2018 – Make Selenium Easy Uncategorized
ExceptionRegClasses – Make Selenium Easy Uncategorized
Interview Experience At Morgan Stanley Mumbai For SDET – Sep – 2020 Uncategorized
How To Filter List Using Java Stream API? Uncategorized
API Testing Tutorial Part 14 – Sending First GET Request in Postman – Make Selenium Easy Uncategorized
image – Make Selenium Easy Uncategorized

Recent Posts

  • Getting Started with Selenium 4: What Is New and How to Upgrade from Selenium 3
  • Manual Testing
  • Baby Steps To Become Efficient Selenium-Java Automation Tester
  • Features of Selenium 4.0.0 Release – Java Binding
  • Part 1: Handling Drop-down Created Using SELECT Tag In Selenium

Recent Comments

No comments to show.

Archives

  • April 2026
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • April 2024
  • March 2024
  • February 2024
  • December 2023
  • October 2023
  • August 2023
  • November 2022
  • September 2022
  • August 2022
  • July 2022
  • May 2022
  • March 2022
  • October 2021
  • April 2021
  • March 2021
  • January 2021
  • December 2020
  • October 2020
  • September 2020
  • August 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • May 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • January 2018

Categories

  • Getting Started
  • Uncategorized

Copyright © 2026 Make Selenium Easy.

Powered by PressBook Masonry Dark