How to use XPath Helper Tool

0 votes
I have installed Xpath helper. But, how will I use it?
Jan 17, 2019 in Selenium by Neha
• 6,300 points
4,136 views

2 answers to this question.

0 votes
  1. Open a new tab and navigate to any webpage. 
  2. Hit Ctrl-Shift-X (or Command-Shift-X on OS X), or click the XPath Helperbutton in the toolbar, to open the XPath Helper console.
  3. 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.
  4. If desired, edit the XPath query directly in the console. The results box will immediately reflect your changes.
  5. Repeat step (2) to close the console.
answered Jan 17, 2019 by Frankie
• 9,810 points
0 votes

How to Install XPath Helper Plugin for Chrome Browser?

1) Go to https://chrome.google.com/webstore/detail/xpath-helper/hgimnogjllphhhkhlmebbmlgjoejdpjl?hl=en

2) Click on Add to Chrome.

XpathHelper_1

Note: If you open the URL in any other browser, you will see the option ‘Available in Chrome’ instead of ‘Add to Chrome’

3) Click on Add button.

XpathHelper_2

4) Once it is installed, it will display a pop up message for Succesful installation.

IMPORTANT: After installing this extension, you must reload any existing tabs or restart Chrome for the extension to work.

5) Now the icon for XPath Helper will appear on the top right most side of the Chrome browser. Just click on it to open the helper.

XpathHelper_3

How to use XPath Helper Tool?

Instructions:

  1. Open a new tab and navigate to any webpage. I have used www.DemoQA.com for demo.
  2. 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.
  3. 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.
  4. If desired, edit the XPath query directly in the console. The results box will immediately reflect your changes.
  5. Repeat step (2) to close the console.

Note: 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.

One word of caution: When rendering HTML tables, Chrome inserts artificial <tbody> tags into the DOM, which will consequently show up in queries extracted by this extension.

Build your own XPath

For Registration Link on the page, try your own XPath: //li[@id=’menu-item-374′]

XpathHelper_4

Note: In case of invalid  XPath, the result side will display error but if the XPath syntax is correct and no matches found then it will say NULL.

Try another XPath for the same element: //li[@id=’menu-item-374′]

XpathHelper_5

answered Apr 27, 2019 by Ajay

Related Questions In Selenium

+1 vote
1 answer
0 votes
2 answers
0 votes
1 answer
0 votes
2 answers

How to use Selenium with Python?

Hey Shubham, you can checkout this thread ...READ MORE

answered Aug 26, 2019 in Selenium by Abha
• 28,040 points
369 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,520 points
5,571 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,100 points
6,174 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,890 points
3,832 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 2, 2020 in Selenium by Sri
• 3,100 points
4,716 views
0 votes
1 answer

How to Install XPath Helper Plugin for Chrome Browser?

1) Go to https://chrome.google.com/webstore/detail/xpath-helper/hgimnogjllphhhkhlmebbmlgjoejdpjl?hl=en 2) Click on Add to Chrome. 3) ...READ MORE

answered Jan 17, 2019 in Selenium by Frankie
• 9,810 points
1,280 views
0 votes
1 answer