A Comprehensive Guide To Locators In Selenium

1 Year Subscription

Selenium has always been the first choicest tool for automation developers to develop the web automation framework. Selenium “Locator” is just a fancy word that is used to instruct the browser driver a path to find the right element.

Selenium locators are said to be one of the most powerful commands that act as building blocks of automation scripts. With the help of selenium locators, we can locate the application GUI elements to perform the desirable operations. These are one of the most sensitive parameters of Selenium where a little mistake in creating a selenium locator can fail the automation script, hence, the entire automation suite is dependent on selenium locators.

To interact with multiple web elements, we have multiple types of locators in Selenium WebDriver. Below is a list of the selenium locators available:

  1. ID
  2. Name
  3. Class Name
  4. XPath
  5. CSS Selector
  6. Linktext
  7. Partial Linktest
  8. Tag Name
  9. DOM Locator

Further, Selenium defines two below methods for identifying web elements:

  • findElement :…


Continue reading on source link

Leave a Comment

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

− 1 = 1