Value in the drop down can be selected using WebDriver’s Select class.
//selectByValue: Select selectByValue = new Select(driver.findElement(By.id(“SelectID_One”))); selectByValue.selectByValue(“greenvalue”);
//selectByVisibleText: Select selectByVisibleText = new Select (driver.findElement(By.id(“SelectID_Two”))); selectByVisibleText.selectByVisibleText(“Lime”);
//selectByIndex: Select selectByIndex = new Select(driver.findElement(By.id(“SelectID_Three”))); selectByIndex.selectByIndex(2);
|