我使用Selenium 3.0和Firefox 48來自動化應用程序。但在firefox48,自動選擇下拉不起作用。選擇下拉不能在Firefox 48中使用硒webdriver
對於IE和Chrome,相同的代碼工作正常。
這是瀏覽器或我的代碼問題?
Select sel = new Select(driver.findElement(By.xpath("//select[contains(@id,'BusinessUnit')]")));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("ctl00_vmsContent_rdwBusinessUnit_C_selBusinessUnit")));
List<WebElement> list = sel.getOptions();
for (WebElement el : list)
{
System.out.println(el.getText());
sel.selectByIndex(2);
}
試試這個答案http://stackoverflow.com/questions/39224373/unable-to-select-dropdown-option-after-updating-jar-files-to-selenium-3-0/39228389#39228389 –
@naveen,你有什麼錯誤嗎? –