【发布时间】:2016-12-25 21:09:09
【问题描述】:
我尝试了为 FF48 和 selenium 3 打开木偶的新 geckodriver,但测试无法在下拉列表中为任何元素选择选项。我的测试在 FF45 和所有其他浏览器中运行良好。只有木偶驱动不选择下拉列表中的选项
new Select(driver.findElement(By.Id("topic"))).selectByVisibleText(item);
在我开始将壁虎驱动程序与木偶一起使用之前,代码运行良好。
下面是我用来设置 geckodriver 和木偶的代码。
System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir")+"\\geckodriver.exe");
ProfilesIni profile = new ProfilesIni();
FirefoxProfile myprofile = profile.getProfile("DefaultProfile");
myprofile.setPreference("network.proxy.type", ProxyType.AUTODETECT.ordinal());
DesiredCapabilities dc=DesiredCapabilities.firefox();
dc.setCapability(FirefoxDriver.PROFILE, myprofile);
dc.setCapability("marionette", true);
driver = new FirefoxDriver(dc);
测试在尝试从元素中选择选项时不会抛出任何异常。
new Select(driver.findElement(By.Id("topic"))).selectByVisibleText(item);
研究了这个问题,发现FF48有一个bug,在firefox ngithly 51中修复了。 在我等待 FF51 发布期间,是否有任何解决方法可以让它在 FF48 中运行?
【问题讨论】:
标签: firefox selenium-webdriver webdriver selenium-firefoxdriver geckodriver