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
Comentarios