如何从Selenium Webdriver的下拉菜单中选择元素?
driver.get("http://www.terna.it/SistemaElettrico/TransparencyReport/Load/Dayaheadloadforecast.aspx");
driver.manage().window().maximize();
Actions a = new Actions(driver);
String Year = "2015";
//WebElement dropdown = driver.findElement(By.id("dnn_ctr5826_TernaViewDocumentView_cbAnno_Input"));
// WebElement tab_down = driver.findElement(By.id("dnn_ctr5826_TernaViewDocumentView_cbAnno_DropDown"));
a.moveToElement(driver.findElement(By.id("dnn_ctr5826_TernaViewDocumentView_cbAnno_DropDown"))).sendKeys("2015").click();
search_fn.setClickyear();
HTML代码:
<input name="dnn$ctr5826$TernaViewDocumentView$cbAnno" type="text" class="rcbInput radPreventDecorate" id="dnn_ctr5826_TernaViewDocumentView_cbAnno_Input" value="2019" readonly="readonly" autocomplete="off">