Difference Between findelement and findelements in Selenium Webdriver

Hello Welcome to Selenium Tutorials, In this post, we will see what is the difference between FindElement and findElements in Selenium.

 

Difference Between findelement and findelements in Selenium Webdriver

 

Difference Between findelement and findelements in Selenium Webdriver

findElement () will return only single WebElement and if that element is not located or we use some wrong selector then it will throw NoSuchElement exception.

findElements() will return List of WebElements – for this we need to give locator in such a way that it can find multiple elements and will return you list of web elements then using List we can iterate and perform our operation.

We will discuss through the basic program  and will use http://jqueryui.com/ for our sample application.

 

Program 1- for findElement

Program 2- for findElements()

 

If you still have some query then comment in below section.

Thanks for visiting my blog. Keep in touch.

Have a nice day 🙂

2 Comments

Leave a Reply