β 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!
Top comments (0)