How would I go about looping through a list of elements and finding out whether the list ends with a specific letter?
My code keeps breaking on the if
line saying stale element. Any suggestions?
My code is as follows:
boolean ListEndsWithLetter(String column, String text) {
List<WebElement> liElements = driver.findElements(By.xpath("//div[@col-id='" + column + "']"));
for (int i = 0; i < liElements.size(); i++) {
if (liElements.get(i).getText().endsWith(text))
return true;
return false;
}
}