org.openqa.selenium.support.ui.Select select = new org.openqa.selenium.support.ui.Select(driver.findElement(By.name("NR"))); select.selectByValue(optionValue);
用selenium.support中封装好的,使用下拉框
import org.openqa.selenium.support.ui.Select;
// 选中下拉框标签,并选择某个值 public void dropDownBox(By by, String value) { WebElement element = driver.findElement(by); Select select = new Select(element); select.selectByValue(value); }