findElement() | findElements() |
---|---|
The first web element that matches the locator is returned. | It gives you a list of all the web items that match the locator. |
If there are no matching web elements, a NoSuchElementException is produced. | If there are no matching elements, an empty list is returned. |
Syntax − WebElement button = webdriver.findElement(By.name("<<Name value>>")); |
Syntax − List<WebElement> buttons = webdriver.findElements(By.name("<<Name value>>")); |