How to find xpath in Chrome browser and Write for Selenium

Welcome to Selenium tutorial, in this post, we will see how to find xpath in Chrome browser for Selenium script development.

Till now we have seen that we have so many plugins for xpath in Firefox Browser like Firebug and Firepath but for Chrome, IE and another browser we do not have a plugin to identify xpath.

In the last post,we have seen Awesome plugin in Firefox for xpath and  if you still have not used then please give a try. 🙂

Today I was googling something and found one good post for Xpath in chrome browser and I installed the same on my machine and it worked easily so thought of sharing with all.

This plugin will not generate xpath like firebug and other plugin do but yes, you can verify your xpath at least.

Find xpath in Chrome browser

Install Xpath Helper plugin for Chrome.

1- Open below URL and Click on Add to Chrome button.

Xpath Helper- https://chrome.google.com/webstore/detail/xpath-helper/hgimnogjllphhhkhlmebbmlgjoejdpjl?hl=en

Xpath plugin in Chrome browser

 

Step 2- Once plugin added to Chrome. Open your application and press SHIFT+CTRL+X. Black window will appear on top then you can play with xpath. Refer below screenshot for more details.

 

find xpath in Chrome browser

 

On the top left page, you can write xpath and the right-hand side you can check the result. If single result found then it will show result 1 and if it matches with multiple items then it will show you count as well.

If xpath is invalid- then you will get xpath error and if no matches found then it will display NULL.

Note- To check element attribute still you can use F12 that is nothing but default inspect element for all browser then check attribute and create your own xpath and try.

 

Xpath Syntax

// tagname[@attribute-name=’value1′]  and if you are not sure about tag name then no worry you can try with * also

// *[@attribute-name=’value1′]

 

 

Thanks for visiting my blog. If you find this post informative then please share with your friends.

For more updates like our Facebook Page.

For any Selenium related query Join Facebook Group.

 

 

9 Comments

  1. Nikhil
  2. Ranjith samalla
    • Phani
      • Gaurav Khurana
        • Komal

Leave a Reply