How to Select a Dropdown in Selenium WebDriver using Java

Posted by & filed under Selenium WebDriver, Test Automation.

2 minutes read In order to select a dropdown value with Selenium WebDriver you have to create a Select (in C# it’s called SelectElement) element and not use the default WebElements. import org.openqa.selenium.support.ui.Select; Use our previous post to locate elements with Selenium WebDriver. Select dropdown = new Select(driver.findElement(By.id(“identifier”))); Let’s consider the following dropdown element for our example: