Sunday, 5 July 2015

SE - 2 - findElement() and findElements() - difference !!

- findElement() is used to find/locate single targeted element on webpage while findElements is used to locate a list of elements.

- if targeted element is not found on webpage findElement() will return NoSuchElement exception while findElements() will not throw any exception but will show empty list.

- generally the results of findElements() are stored in List while result of findElement can be stored in any webelement variable.

-if there are multiple elements and we use findElement() it will just return the first occurrence of the elements.

-findelements() returns List of webelements from a webpage

No comments:

Post a Comment