What is the difference between driver.findElement() and driver.findElements() commands?

558    Asked by ajithJayaraman in QA Testing , Asked on Dec 11, 2019
Answered by ajith Jayaraman

The distinction among driver.findElement() and driver.findElements() directions is-

findElement() restores a solitary WebElement (discovered first) in view of the locator went as parameter. While findElements() restores a rundown of WebElements, all delightful the locator esteem passed.

Linguistic structure of findElement()-

WebElement text box = driver.findElement(By.id("textBoxLocator"));

Linguistic structure of findElements()-

Rundown components = element.findElements(By.id("value"));

Another distinction between the two is-on the off chance that no component is discovered, at that point findElement() tosses NoSuchElementException while findElements() restores a rundown of 0 components.



Your Answer

Interviews

Parent Categories