Let’s use the following method for this discussion:
public void setOption(String optionName) {
WebElement dropDown = driver.findElement(dropDownBy);
dropdown.click();
List<WebElement> options = driver.findElements(optionsBy);
for (WebElement option : options) {
if (option.getText().equalsIgnoreCase(FILTER)) {
option.click();
break;
}
}
saveChanges();
refreshPage();
waitForHeaderToAppear();
}
Is this method doing too much?
Keep reading with a 7-day free trial
Subscribe to Selenium For Beginners to keep reading this post and get 7 days of free access to the full post archives.