代码之家  ›  专栏  ›  技术社区  ›  user7439525

Selenium Webdriver 3.3.1 gecko driver 0.18 Firefox 55.0.03 URL未打开

  •  1
  • user7439525  · 技术社区  · 9 年前

    尝试使用Selenium Webdriver 3.3.1 gecko driver 0.18启动firefox浏览器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 回复  |  直到 9 年前
        1
  •  0
  •   undetected Selenium    9 年前

    你看到的错误说明了一切 Build info: version: Driver info: driver.version: . 您的构建信息;版本不会被gecko驱动程序捕获和打印。主要原因是 Selenium , GeckoDriver & 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.1 通过 geckodriver v0.18.0 SessionNotCreatedException .

        2
  •  0
  •   iamsankalp89    9 年前

    下载最新版本的selenium jar文件,即3.5并试用。当我读到你使用geckodriver v0.18时,请使用最新的jar。

        3
  •  0
  •   SaiPawan Maximiliano alves    9 年前

    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);