Hi I have an ArrayList
and a WebElement
list with same data. I need to know how I can compare the values in my ArrayList
with values in my List WebElements
:
ArrayList<String> shift = new ArrayList<String>();
shift.add("A1");
shift.add("A2");
shift.add("A3");
shift.add("B1");
shift.add("B2");
shift.add("B3");
System.out.println("List of all elements: " + shift);
List<WebElement> elements = driver.findElements(By
.className("shift-names"));
for (WebElement element : elements) {
System.out.println(element.getText());
}