Below is one of the simple and straight forward way to assert list of values.
This is applicable when we want to validate table data or values from multiple webelements.
List<String> expectedData = new ArrayList<>(Arrays.asList("Madan","Blog"));
List<String> optionValues = new ArrayList<>();
new Select(element).getOptions().stream().forEach(listOption -> optionValues.add(listOption.getText()));
Assert.assertEquals(optionValues,expectedData);
No comments:
Post a Comment