top of page

Difference between findElement() and findElements()

sejalben3

hence, loc means Locator

findElement(loc) ----> returns WebElement

findElements(loc) ----> return type List<WebElement>


Scenario1: locator is matching with single web element.

------- returns return type

findElement(loc) ---->single webelement WebElement

findElements(loc)--->single webelement List<WebElement>


Scenario2: locator is matching with multiple web elements

------------------

findElement(loc)---->single webelement(first) WebElement

findElements(loc) ---> multiple web elements List<WebElement>


Scenario3: locator is incorect ( No elements are not matching with locator)

------

findElement(loc)----> NoSuchElementException

findElements(loc)--->returns zero


8 views0 comments

Recent Posts

See All

Battle of the Backends: Java vs Node.js

Comparing Java and Node.js involves contrasting two distinct platforms commonly used in backend development. Here’s a breakdown of their...

留言


bottom of page