⟩ Please explain what is the difference between findElement () and findElements ()?
Both of them let user to find elements in the current web page matching to the specified locator value. But if you use findElement(), only the first matching element would be fetched. An example:
WebElement element = driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”))
If you use findElements(), the all matching elements would be fetched and stored in the WebElements list. An example:
List elementList = driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”));