【发布时间】:2019-03-06 08:53:22
【问题描述】:
我正在尝试运行以下 Java 代码:
package tests;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class sekcija9 {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver","C:\\Program Files\\Mozilla Firefox\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
}
}
我收到以下错误:
Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line
我正在使用:
火狐62.0.2 64位
硒 3.3.1
GeckoDriver 0.22.0(最新)
我看过这里:link
我需要降级 Firefox 版本吗?如果没有,如何在不降级的情况下解决此问题?
【问题讨论】:
-
考虑升级您的 selenium 版本。我正在使用 3.14.0 和 gecko 驱动程序 .22.0 和 firefox Firefox 62.0.2 ,它工作正常。