Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

1 like 0 dislike
493 views
by The go-to Tester (324 points)
closed by
difference between find elements () and find element () ?
closed with the note: got it.

1 Answer

0 like 0 dislike
by The go-to Tester (181 points)
edited by
In selenium webdriver,

FindElement will return you the element found using your locator.

e.g. driver.findElement(By.id("username")); //will return username text box.

FindElement will return you List of elemnets found using that locator.

 e.g. driver.findElements(By.tagName("tr")); //will return you all rows in the table in form of List<WebElement>
 
You use findElement when you have only one element with that locator on the page. You use findElements when we want mutliple elements to be identified with the same locator type. 

Hope that helps!


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...