π Difference Between FindElement and FindElements in Selenium.π
Pramod Dutta
Posted on July 3, 2020
β 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.
β 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!
π πͺ π
π©
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
testing ππ What is TDD (Test Driven Development)? | How to do TDD with Example ππ
June 25, 2020