LOCATING AN ELEMENT
Locators There are different locators that are used in selenium to locate an element, Any element can be stored using WebElement interface. The locators used are: ID Name Link Text Partial Link Text Xpath CSSSelector Let us discuss them in detail: How can we locate an element by ID? we are trying to book a flight ticket from Yatra.com website. To book, we need to search a flight & while searching a flight, we need to provide the details of From, To, Depart, Return and Passenger count. If we need to automate this functionality, we can identify these elements using the ID. Please find the screenshot below: From the above screen you can see that the element 'From' can be detected by its ID 'BE_flight_origin_city'. So to detect the element, we write: WebElement element = driver.findElement(By.id("BE_flight_origin_city")); Here driver is an instance of 'WebDriver' interface. How can we locate an element by 'Name...