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

promode

Pramod Dutta

Posted on July 3, 2020

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

βœ… 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
driver.get(β€œhttps://katalon-demo-cura.herokuapp.com/β€œ);
 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
 driver.get(β€œhttps://katalon-demo-cura.herokuapp.com/β€œ);
 List<WebElement>  ptags=driver.findElements(By.tagName(β€œp”));

--
Be sure to subscribe for more videos like this!

 TheTestingAcademy

πŸ’– πŸ’ͺ πŸ™… 🚩
promode
Pramod Dutta

Posted on July 3, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related