我尝试了新的 geckodriver,并为 FF48 和 selenium 3 打开了 marionette,但测试无法在任何元素的下拉列表中选择选项。我的测试在 FF45 和所有其他浏览器中运行良好。只有木偶驱动程序没有选择下拉列表中的选项
new Select(driver.findElement(By.Id("topic"))).selectByVisibleText(item);
该代码工作正常,直到我开始将 gecko 驱动程序与 marionette 一起使用。
下面是我用 marionette 设置 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 48 中的一个错误。它在 Firefox 51(Nightly build)中得到了修复。
如果您使用 Selenium 3 beta 和 Firefox 48 以及 geckodriver,您将无法使用 webdriver 与任何下拉列表进行交互。该问题已在 Firefox 51 中得到修复。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)