adspace
How to handle a dropdown in selenium webdriver? How to select a value from dropdown?
Answer Posted / Vikram Singh Raghav
To handle a dropdown in Selenium WebDriver, you can use the Select class. First, wrap the dropdown with Select, and then you can use its methods like selectByVisibleText(), selectByValue(), or selectByIndex() to choose an option:
WebElement dropdown = driver.findElement(By.id("dropdown-id"));
Select select = new Select(dropdown);
select.selectByVisibleText("Dropdown Option");
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers