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 the default Firefox Dev Tools Copy options to auto-generate the XPath Expressions and CSS Selectors.
In this article, I am going to practically demonstrate auto-generating XPath Expressions and CSS Selectors using the default Firefox Dev Tools Copy options.
Let’s get started.
Selenium Locators – Using Default Firefox Copy XPath and Copy CSS Selector options
Follow the below steps for auto-generating the XPath Expressions and CSS Selector for the UI elements on the page using the default Firefox Browser Dev Tools Copy options.
1) Open any application URL say http://omayo.blogspot.com/ in Firefox browser, right-click on the UI element say ‘Button2’ button and select ‘Inspect’ option as shown below:
2) Right-click on the HTML code that got highlighted in the default Firefox Dev Tools section on inspecting the ‘Button2’ button in the above step and select ‘Copy XPath’ or ‘Copy CSS Selectors’ options as shown below:
Select the above ‘Copy’ options to copy the auto-generated XPath Expressions and CSS Selectors by the default Firefox Browser Dev Tools Copy options and use them for locating the required UI elements 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.