Sunday, November 23, 2014

Selenium API - Drop Down and Multiple selects

Select dropdown = new Select(driver.findElement(By.id("identifier")));
<html>
<body>
<select id = "designation">
<option value = "MD">MD</option>
<option value = "prog"> Programmer </option>
<option value = "CEO"> CEO </option>
</option>
</select>
<body>
</html>

Select dropdown = new Select(driver.findElement(By.id("designation")));

dropdown.selectByVisibleText("Programmer ");
dropdown.selectByValue("prog");

No comments:

Post a Comment