SOA*_*thm 9 firefox webdriver selenium-firefoxdriver selenium-webdriver geckodriver
我尝试使用新的geckodriver,为FF48和selenium 3打开牵线木偶,但测试无法在下拉列表中为任何元素选择选项.我的测试在FF45和所有其他浏览器中都能正常工作.只有牵线木偶驱动程序不会在下拉列表中选择该选项
new Select(driver.findElement(By.Id("topic"))).selectByVisibleText(item);
Run Code Online (Sandbox Code Playgroud)
代码工作正常,直到我开始使用gecko驱动程序与木偶.
下面是我用来设置带木偶的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);
Run Code Online (Sandbox Code Playgroud)
当尝试从元素中选择一个选项时,测试不会抛出任何异常.
new Select(driver.findElement(By.Id("topic"))).selectByVisibleText(item);
Run Code Online (Sandbox Code Playgroud)
在研究了这个问题之后,结果发现FF48有一个bug并且它已经在firefox中修复了51.在等待FF51发布的时候,是否有任何解决方法使它在FF48中工作?
我很惊讶没有人遇到这个问题。我想我可能把问题发布在错误的地方,因为我没有得到任何回复。不管怎样,这被证明是 Firefox 48 中的一个错误。它在 Firefox 51(Nightly build)中得到了修复。
如果您使用 Selenium 3 beta 和 Firefox 48 以及 geckodriver,您将无法使用 webdriver 与任何下拉列表进行交互。该问题已在 Firefox 51 中得到修复。
| 归档时间: |
|
| 查看次数: |
2198 次 |
| 最近记录: |