Selenium Webdriver 3.3.1 gecko driver 0.18 Firefox 55.0.03 URL无法打开

时间:2017-09-05 05:54:16

标签: selenium selenium-webdriver selenium-firefoxdriver

尝试使用Selenium Webdriver启动firefox浏览器3.3.1 gecko驱动程序0.18 Firefox 55.0.03 URL未打开。我收到以下错误:

 1504590431182  geckodriver INFO    Listening on 127.0.0.1:17925 Sep 05,
 2017 11:17:11 AM org.openqa.selenium.remote.ProtocolHandshake
 createSession INFO: Attempting bi-dialect session, assuming Postel's
 Law holds true on the remote end 1504590431839 geckodriver::marionette INFO    Starting browser  \\?\C:\Program Files (x86)\Mozilla Firefox\firefox.exe with args["-marionette"] 1504590433890 addons.manager  ERROR   startup failed:
 [Exception... "Component returned failure code: 0x80070057
 (NS_ERROR_ILLEGAL_VALUE) [nsIFile.create]"  nsresult: "0x80070057
 (NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame ::
 resource://gre/modules/FilJavaScerUitpitl se.rjrsomr :: :r
 eFsioluerUctei:l/s/_ggreet/Dmiord u:l:e sl/iAnded o7n0M"a n
 adgaetra.:j snmo,]  lSitnaec k1 5t9r6a:ce: 
 NFSi_lEeRURtOiRl_sN_OgTe_tIDNiIrT(I)A@LrIeZsEoDu:r
 cAed:d/o/ngMraen/amgoedru liess /nFoitl eiUntiitlisa.ljiszme:d7 0  <
 FileUtils_getFile()@resource://gre/modules/FileUtils.jsm:42 <
 validateBlocklist()@resource://gre/modules/AddonManager.jsm:656 <
 startup()@resource://gre/modules/AddonManager.jsm:816 <
 startup()@resource://gre/modules/AddonManager.jsm:3122 <
 observe()@jar:file://///%3F/C:/Program%20Files%20(x86)/Mozilla%20Firefox/omni.ja!/components/addonManager.js:65
 1504590434086  Marionette  INFO    Enabled via --marionette JavaScript
 error: resource://gre/modules/AddonManager.jsm, line 2465:
 NS_ERROR_NOT_INITIALIZED: AddonManager is not initialized JavaScript
 error: resource://gre/modules/AddonManager.jsm, line 3137: TypeError:
 AddonManagerInternal._getProviderByName(...) is undefined
 1504590435547  Marionette  INFO    Listening on port 54969
 1504590435588  Marionette  INFO    Listening on port 54969 Sep 05, 2017
 11:17:16 AM org.openqa.selenium.remote.ProtocolHandshake createSession
 INFO: Falling back to original OSS JSON Wire Protocol. Sep 05, 2017
 11:17:16 AM org.openqa.selenium.remote.ProtocolHandshake createSession
 INFO: Falling back to straight W3C remote end connection Exception in
 thread "main" org.openqa.selenium.SessionNotCreatedException: Unable
 to create new remote session. desired capabilities = Capabilities
 [{marionette=true,
 firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions@71e53b,
 browserName=firefox,
 moz:firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions@71e53b,
 version=, platform=ANY}], required capabilities = Capabilities [{}]
 Build info: version: Driver info: driver.version:
 FirefoxDrive

请为此提供解决方案。

3 个答案:

答案 0 :(得分:0)

下载最新版本的selenium jar文件,即3.5并试用。正如我读到的那样,你使用了geckodriver v0.18,所以使用最新的jar。

答案 1 :(得分:0)

下载selenium最新稳定版本,即selenium 3.5.3,并按如下所示创建驱动程序。

System.setProperty("webdriver.gecko.driver",geckoDriverPath);
FirefoxProfile ffProfile = new FirefoxProfile();
ffProfile.setPreference("browser.tabs.remote.autostart.2", false);
FirefoxOptions options=new FirefoxOptions();
options.setProfile(ffProfile);
driver = new FirefoxDriver(options);

从下面的链接下载最新的geckoDriver。

Link to download geckodriver

在下面的代码中,解决了退出驱动程序时浏览器崩溃的问题。

ffProfile.setPreference("browser.tabs.remote.autostart.2", false);

答案 2 :(得分:0)

您看到的错误表明全部Build info: version: Driver info: driver.version:。您的构建信息&amp;版本没有被gecko驱动程序捕获和打印。主要原因是 Selenium GeckoDriver &amp; Mozilla Firefox Browser 版本与Test Environment不兼容。

您提到了Selenium Webdriver 3.3.1 gecko driver 0.18 Firefox 55.0.03

geckodriver v0.18.0的发行说明清楚地提到了以下依赖:

  

<强> Note that geckodriver v0.16.0 is only compatible with Selenium 3.4 and greater.

当您尝试使用Selenium v3.3.1geckodriver v0.18.0时,您会看到 SessionNotCreatedException