What are locaters in selenium
- Locators in Selenium are one of the most required and important commands. Because they are building block of automation scripts
- It helps to locate the GUI elements through which multiple user actions can be performed.
- Using the right locator ensures the tests are faster, more reliable or has lower maintenance over releases
- Incorrect locators may lead to automation failure
Types of locators
- ID
- Name
- ClassName
- Tag Name
- Link Text and Partial Link Text
- CSS Selector
- Xpath
Ways to find the locators in Browsers
- Firepath, Firebug addons for firefox browser
- ChroPath
- Direct method using f12 – developer tools
How to pass the locators in Automation
Locating elements in WebDriver is done by using the method
- findElement(By.locator())
- findElements(By.locator())
Comments
Post a Comment