Question - When do we use findElement() and findElements()?
Answer -
A. findElement()
It finds the first element in the current web page that matches the specified locator value.
Syntax:
WebElement element=driver.findElements(By.xpath(“//div[@id=‘example’]//ul//li”));
B. findElements()
It finds all the elements in the current web page that matches the specified locator value.
Syntax:
List elementList=driver.findElements(By.xpath(“//div[@id=‘example’]//ul//li”));