Firefox 66.0和Geckodriver 0.24.0不兼容吗?

时间:2019-05-27 10:41:11

标签: selenium-webdriver geckodriver selenium-firefoxdriver

无法启动Firefox。

尝试过 Firefox 66.0和Geckodriver geckodriver 0.24.0

使用Firefox 61.0和Geckodriver geckodriver 0.21.0

FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("webdriver.log.driver", "INFO");
profile.setPreference("webdriver.log.file", targetDir + File.separator + "firefoxSeleniumServer.log");
profile.setPreference("browser.download.folderList",2);
profile.setPreference("browser.download.manager.showWhenStarting",false);
profile.setPreference("browser.helperApps.neverAsk.saveToDisk","text/csv;text/plain");
if(platform.equalsIgnoreCase("linux")) {
FirefoxOptions options = new FirefoxOptions();

profile.setPreference("browser.download.dir",System.getProperty("user.dir")+ File.separator + "target");
System.setProperty("webdriver.gecko.driver", "/geckodriver/geckodriver");
System.setProperty("webdriver.firefox.bin","/usr/bin/firefox/firefox");

options.setCapability(CapabilityType.PLATFORM_NAME,Platform.LINUX);
options.setCapability("marionette", true);
options.setCapability("webdriver.firefox.profile",DesiredCapabilities.firefox());
driver = new FirefoxDriver();
}

会话ID:8d18af2e-b532-4991-af81-d446fb07bb6c     在sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)

由以下原因引起:java.lang.RuntimeException:分叉过程中发生错误 org.openqa.selenium.NoSuchSessionException

1 个答案:

答案 0 :(得分:0)

根据此页面,'https://github.com/mozilla/geckodriver/releases'v0.24.0'也将支持65个以上的版本。要解决这些版本问题,您可以尝试使用“ https://github.com/bonigarcia/webdrivermanager”,而无需为每个浏览器添加/替换exe文件。