How to use XPath Helper Tool?

0 votes
I have installed Xpath helper. But, how will I use it?
Jan 17 in Selenium by Neha
• 6,280 points
272 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 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 by Ajay

Related Questions In Selenium

+1 vote
1 answer
0 votes
1 answer
0 votes
1 answer

How to use Selenium with Python?

There are many resources for selenium - ...READ MORE

answered Mar 30, 2018 in Selenium by nsv999
• 5,050 points
145 views
0 votes
1 answer

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,050 points
408 views
0 votes
1 answer
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,130 points
764 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
403 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 in Selenium by Frankie
• 9,810 points
212 views
0 votes
1 answer