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 TruePath in Chrome browser to auto-generate the XPath Expressions.
Note: TruePath add-on of chrome browser can only be used for auto-generating different XPath Expressions for the same UI element on the page.
In this article, I am going to practically demonstrate auto-generating different XPath Expressions using the TruePath chrome add-on.
Let’s get started.
Installing and using TruePath Add-on in Chrome
Follow the below steps for auto-generating the different XPath Expressions for the UI elements on the page using TruePath Add-on in Chrome browser:
1) Open Chrome browser, google search for ‘TruePath’ and click on the below link from the search results:
2) Click on the ‘Add to Chrome’ button from the Chrome Web Store page of ‘TruePath’ as shown below:
3) Click on ‘Add Extension’ button on the displayed dialog as shown below:
4) Observe that the TruePath 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) As TruePath Add-on is successfully installed and added to the chrome browser, we can simply get it options by right-clicking on the page.
Let’s right-click on the ‘Button2’ button and observe that we are getting the ‘Relative XPath’ option of ‘TruePath’ in the right-click menu as shown below:
As you can see in the above screenshot, multiple XPath Expressions are generated for the ‘Button2’ button by the ‘TruePath’ add-on. Let’s say I have felt the below XPath option is best and selected it as shown below:
On selecting one of the above auto-generated XPath Expression, ‘TruePath-Home’ window with the selected XPath Expression and ‘Copy’ button will be displayed as shown below:
Click on the above ‘Copy XPath’ button to copy the auto-generated XPath Expression by the TruePath addon and use it for locating the required UI element on the web page.
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.