▼ Show 1 Answer

0 votes
The difference between driver.findElement() and driver.findElements() commands is-

findElement() returns a single WebElement (found first) based on the locator passed as parameter. Whereas findElements() returns a list of WebElements, all satisfying the locator value passed.

Syntax of findElement()-

WebElement textbox = driver.findElement(By.id(“textBoxLocator”));

Syntax of findElements()-

List <WebElement> elements = element.findElements(By.id(“value”));

Another difference between the two is- if no element is found then findElement() throws NoSuchElementException whereas findElements() returns a list of 0 elements.
Learn More with Madanswer

Related questions

0 votes
asked Aug 22, 2019 in Selenium by john ganales