what are the different types of locators in selenium? which one is preferable to use? code example

Example: types of locators in selenium

--> WHAT ARE LOCATORS? 
    - Locators are methods that are used to locate HTML web elements for 
      Selenium browser driver.
      
--> WHAT IT IS USED FOR? 
    - It is used to locate any specific web element 
    on the UI of AUT (application under test)

--> HOW MANY Selenium LOCATORS?
   - There are 8 locators.
    - id, class, name, linktext, partialLinktext, cssSelector, xpath, tagName

Tags:

Misc Example