How can I select an item from a drop down list like this gender(i.e male,female from dropdown)
using selenium webdriver with Java?
I have tried this
WebElement select = driver.findElement(By.id("gender"));
List<WebElement> options = select.findElements(By.tagName("Male"));
for (WebElement option : options) {
if("Germany".equals(option.getText()))
option.click();
}
but this didn't succeed.