Saturday, May 24, 2014

Difference between findElement & findElements

Difference between findElement & findElements

The purpose of findElement is to return a WebElement. findElements return a list of WebElements. Both findElement and findElements are affected by the “implicit wait” times in force at the time of the execution.

findElement findElements
findElement will throw NoSuchElementException if there is no matching element found. findElements will return an empty list if no matching elements are found and no exception of any type will be thrown.
findElement will find the first matching element. findElements will find all the matching elements.

Below are few of the awesome links in case you need to look at findElement & findElements examples:

1. What is the difference between driver.findElement() and driver.findElements()? [Link]
2. What is the difference between findElement and findElements in Webdriver. [Link]
3. What is difference between findElements and findElement selenium Webdriver? [Link]
4. Difference between findElement and findElements of Webdriver. [Link]
5. Selenium WebDriver : findElement() Vs findElements() functions. [Link]
6. Difference between find element () and find elements ()? [Link]
7. Selenium WebDriver : Difference Between findElement and findElements with example. [Link]
8. Understanding the Method findElement in Selenium. [Link]