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.
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.
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.
How to use XPath Helper Tool?
Instructions:
- Open a new tab and navigate to any webpage. I have used www.DemoQA.com for demo.
- 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.
- 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.
- If desired, edit the XPath query directly in the console. The results box will immediately reflect your changes.
- 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′]
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′]