
findElement(): It is used to find the first element in the current web page matching to the specified locator value.
Syntax:
WebElement element = driver.findElement(By.xpath("//*[@id='test']/div"));
findElements(): It is used to find all the elements in the current web page matching to the specified locator value and all the matching elements will be stored in the list as list of WebElements.
Syntax:
List<WebElement> elementList = driver.findElements(By.xpath("//*[@id='test']/div"));
No comments:
Post a Comment