In Selenium Webdriver, QA engineers use locators to locate an element on the web page. This is mainly done by using findElement() and findElements() methods.
Below are the different types of locators to find an element:
- By XPath: Element is located by using Xpath
- By CSS: Element is located by using CSS selector
- By ID: Element is located by using the ID attribute
- By Name: Element is located by using the Name attribute
- By Class Name: Element is located by using the Class attribute
- By Tag Name: Element is located by using an HTML tag
- By Link Text: Element is located by using link text
- By Partial Link Text: Element is located by using the link's partial text
Below are a few locators to find elements faster and unique: