Locators in Selenium

To perform an action on any element, we first have to locate/find it on the web page through various built-in locator strategies which are being offered by Selenium WebDriver.

How do we identify an element in Selenium? #

WebElement name = driver.findElement(By.id("username"));

Get hands-on with 1400+ tech skills courses.