As explained in one of the previous posts, Firebug and Firepath add-ons for locating and validating the UI elements on the page got deprecated and discontinued and we have to use alternative add-ons in place of Firebug and Firepath.
Though ChroPath is the best alternative of Firebug & Firepath in locating the UI elements and validating the XPath Expressions & CSS Selectors, we can also use XPath Finder in Chrome browser to auto-generate the XPath Expressions.
Note: XPath Finder add-on is only available in the Chrome browser and can only be used to auto-generate the XPath Expressions.
In this article, I am going to practically demonstrate auto-generating XPath Expressions using the XPath Finder add-on.
Let’s get started.
Selenium Locators – Installing and using XPath Finder Add-on
Follow the below steps for auto-generating the XPath Expressions using XPath Finder Add-on in Chrome browser:
1) Open Chrome browser, google search for ‘XPath Finder’ and click on the below link from the search results:
2) Click on the ‘Add to Chrome’ button in the Chrome web store page of ‘XPath Finder’ as shown below:
3) Click on ‘Add Extension’ button on the displayed dialog as shown below:
4) Observe that the XPath Finder Add-on got added to the Chrome Browser as shown below:
5) Open any application say http://omayo.blogspot.com/ in the Chrome Browser as shown below:
6) Click on the ‘XPath Finder’ icon on the chrome browser, click on any UI element to be located say the first option ‘Volvo’ in the Multi-selection box field and observe that the XPath Expression for the ‘Volvo’ option will be auto-generated and displayed on the page as shown below:
Note: On clicking the ‘XPath Finder’ icon on the chrome browser, it will get enabled by turning into red color.
7) Select the auto-generated XPath Expression, right-click and select the ‘Copy’ option as shown below:
Copied XPath Expressions can be used for locating the required UI elements on the web pages.
Once you are done auto-generating the XPath Expressions for the required UI elements using XPath Finder, you can click on the ‘XPath Finder’ icon the browser to disable it (i.e. The icon reverts back to black from red color).
Here concludes this article.
In the next article, I will explain a different alternative for Firebug and Firepath.
- > To learn more about Selenium, continue to the next post (Click on Next Post link below)
- > Check complete Selenium Tutorial Contents here (Click here)
Please leave your questions/comments/feedback below.
Happy Learning ?
On a mission to contribute to the Software Testing Community in all possible ways.