Cover image for πŸ›‘ Difference Between FindElement and FindElements in Selenium.πŸ›‘

πŸ›‘ Difference Between FindElement and FindElements in Selenium.πŸ›‘

promode profile image Pramod Dutta Updated on ・1 min read

βœ… Join us - https://sendfox.com/thetestingacademy

In this video, We are going to Difference Between FindElement and FindElements in Selenium.

Selenium defines two methods for identifying web elements:

  • findElement: A command used to uniquely identify a web element within the web page.
  • find elements: A command used to identify a list of web elements within the web page.

 FindElement and FindElements

βœ… Download Code - https://scrolltest.com/automation/day24

βœ…FindElement ()

  • Find a Single element
  • If Element is not found - NoSuchElement exception. Return only single WebElement
 WebElement demos=driver.findElement(by.id(β€œbtn-make-appointment”));

βœ… FindElements()

  • Find multiple elements with xpath/css
  • Return List of WebElements - Returns an empty list if no matching element is found
 List<WebElement>  ptags=driver.findElements(By.tagName(β€œp”));

Be sure to subscribe for more videos like this!


Posted on by:

promode profile

Pramod Dutta


Lead Automation Expert || Founder of TheTestingAcademy.com || Youtube at TheTestingacademy || Udemy Teacher. || scrolltest.com


markdown guide