Test Automation with Selenium WebDriver select dropdown element

By: Slav Kurochkin

If you are writing Test Automation with Selenium WebDriver, most likely you would interact with dropdown, here is how you do it:

WebElement dropDownSelect;
WebElement dropDownOption;

dropDownSelect = driver.findElement(By.xpath("//div[3]"));
dropDownOption = dropDownSelect.findElement(By.cssSelector("option[value='1']"));
View Comments

Leave a Comment

Use markdown or basic HTML and be nice.