HomeSelenium

Selenium Locators – Using Default Chrome Copy XPath and Copy Selector options

Selenium Locators – Using Default Chrome Copy XPath and Copy Selector options

<<Previous Post                            << Complete Tutorial>>                              Next Post>>

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 Chrome 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 Chrome Dev Tools Copy options.

Let’s get started.

Selenium Locators – Using Default Chrome Copy XPath and Copy 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 Chrome Browser Dev Tools Copy options.

1) Open any application URL say http://omayo.blogspot.com/ in Chrome browser, right-click on the UI element say ‘Button2’ button and select ‘Inspect’ option as shown below:

Default Chrome Dev Tools - Inspect

2) Right-click on the HTML code that got highlighted in the default Chrome Dev Tools section on inspecting the ‘Button2’ button in the above step and select ‘Copy XPath’ or ‘Copy selectors’ options as shown below:

Default Chrome Dev Tools - Copy

Select the above ‘Copy’ options to copy the auto-generated XPath Expressions and CSS Selectors by the default Chrome 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.

Next Steps:

  • > 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 🙂

About Me > Arun Motoori

On a mission to contribute to the Software Testing Community in all possible ways.

<<Previous Post                            << Complete Tutorial>>                              Next Post>>

If you like this article, share it on LinkedIn using the below button:

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *