How did you use Collections in your framework? code example
Example: How did you use Collections in your framework?
Collections can be used in selenium in different scenarios, I’m
just trying to mention which I have experienced.
List interface allows duplicate values (elements)
whereas Set interface does not allow duplicate values
1. When there is a dropdown and you know there should
won’t be any duplicate elements, then Set is the best one to
use because it doesn’t allow duplicates.
For e.g. A Web object returns multiple values or more precisely
locator is returning more than 1 object then you need to use
collections like.
List<WebElement> obj = driver. Findelements(by.
Xpath(“value”))
Now obj is a list object which can contain multiple values.