How to select an item from a dropdown list using Selenium WebDriver with java?

Use –

new Select(driver.findElement(By.id("gender"))).selectByVisibleText("Germany");

Of course, you need to import org.openqa.selenium.support.ui.Select;

Leave a Comment