一尘不染

Firefox浏览器未加载并显示错误:typeError:addon为null

selenium

public class firstTest {

    public static void main(String[] args) {

        System.setProperty("webdriver.gecko.driver", "E:\\SOFTWARE\\drivers\\geckodriver.exe");
        WebDriver driver = new FirefoxDriver();
        driver.get("http://www.google.com");
    }
}

在执行上述代码时,出现以下错误:

Unable to read VR Path Registry from C:\Users\DEEPAK D P\AppData\Local\openvr\openvrpaths.vrpath
JavaScript error: resource://gre/modules/addons/XPIProvider.jsm, line 3345: TypeError: addon is null
1521607690370   addons.productaddons    INFO    sending request to: https://aus5.mozilla.org/update/3/GMP/59.0.1/20180315233128/WINNT_x86_64-msvc-x64/en-GB/release/Windows_NT%2010.0.0.0.16299.125%20(x64)/default/default/update.xml
1521607691520   addons.productaddons    INFO    Completed downloading document
1521607692630   addons.productaddons    INFO    downloadXHR File download. status=200
1521607692638   addons.productaddons    INFO    Downloaded file will be saved to C:\Users\DEEPAK~1\AppData\Local\Temp\tmpaddon-c492c1
1521607698968   addons.productaddons    INFO    downloadXHR File download. status=200
1521607698976   addons.productaddons    INFO    Downloaded file will be saved to C:\Users\DEEPAK~1\AppData\Local\Temp\tmpaddon-47ef79

    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:122)
    at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:117)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:207)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
    at tests.firstTest.main(firstTest.java:22)
Exception in thread "main" org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(C:\Program Files (x86)\Mozilla Firefox\firefox.exe) on port 7055; process output follows: 
driver@googlecode.com
1521607670798   addons.xpi  DEBUG   Ignoring file entry whose name is not a valid add-on ID: C:\Users\xxx \AppData\Local\Temp\anonymous4306519380516409248webdriver-profile\extensions\webdriver-staging
1521607670798   addons.xpi  DEBUG   Existing add-on fxdriver@googlecode.com in app-profile
1521607670800   addons.xpi  INFO    Mapping activity-stream@mozilla.org to C:\Program Files (x86)\Mozilla Firefox\browser\features\activity-stream@mozilla.org.xpi
1521607670800   addons.xpi  INFO    Mapping aushelper@mozilla.org to C:\Program Files (x86)\Mozilla Firefox\browser\features\aushelper@mozilla.org.xpi
1521607670800   addons.xpi  INFO    Mapping firefox@getpocket.com to C:\Program Files (x86)\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1521607670800   addons.xpi  INFO    Mapping followonsearch@mozilla.com to C:\Program Files (x86)\Mozilla Firefox\browser\features\followonsearch@mozilla.com.xpi
1521607670800   addons.xpi  INFO    Mapping formautofill@mozilla.org to C:\Program Files (x86)\Mozilla Firefox\browser\features\formautofill@mozilla.org.xpi
1521607670800   addons.xpi  INFO    Mapping onboarding@mozilla.org to C:\Program Files (x86)\Mozilla Firefox\browser\features\onboarding@mozilla.org.xpi
1521607670800   addons.xpi  INFO    Mapping screenshots@mozilla.org to C:\Program Files (x86)\Mozilla Firefox\browser\features\screenshots@mozilla.org.xpi
1521607670800   addons.xpi  INFO    Mapping shield-recipe-client@mozilla.org to C:\Program Files (x86)\Mozilla Firefox\browser\features\shield-recipe-client@mozilla.org.xpi
1521607670800   addons.xpi  INFO    Mapping webcompat@mozilla.org to C:\Program Files (x86)\Mozilla Firefox\browser\features\webcompat@mozilla.org.xpi
1521607670802   addons.xpi  DEBUG   Existing add-on activity-stream@mozilla.org in app-system-defaults
1521607670802   addons.xpi  DEBUG   Existing add-on aushelper@mozilla.org in app-system-defaults
1521607670802   addons.xpi  DEBUG   Existing add-on firefox@getpocket.com in app-system-defaults
1521607670802   addons.xpi  DEBUG   Existing add-on followonsearch@mozilla.com in app-system-defaults
1521607670802   addons.xpi  DEBUG   Existing add-on formautofill@mozilla.org in app-system-defaults
1521607670804   addons.xpi  DEBUG   Existing add-on onboarding@mozilla.org in app-system-defaults
1521607670804   addons.xpi  DEBUG   Existing add-on screenshots@mozilla.org in app-system-defaults
1521607670804   addons.xpi  DEBUG   Existing add-on shield-recipe-client@mozilla.org in app-system-defaults
1521607670804   addons.xpi  DEBUG   Existing add-on webcompat@mozilla.org in app-system-defaults
1521607670806   addons.xpi  INFO    Mapping {82AF8DCA-6DE9-405D-BD5E-43525BDAD38A} to C:\Program Files (x86)\Mozilla Firefox\browser\extensions\{82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}.xpi
1521607670806   addons.xpi  INFO    Mapping {972ce4c6-7e08-4474-a285-3208198ce6fd} to C:\Program Files (x86)\Mozilla Firefox\browser\extensions\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi
1521607670806   addons.xpi  DEBUG   Existing add-on {82AF8DCA-6DE9-405D-BD5E-43525BDAD38A} in app-global
1521607670806   addons.xpi  DEBUG   Existing add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} in app-global
1521607670806   addons.xpi  DEBUG   getInstallState changed: false, state: {}
Unable to read VR Path Registry from C:\Users\DEEPAK D P\AppData\Local\openvr\openvrpaths.vrpath
JavaScript error: resource://gre/modules/addons/XPIProvider.jsm, line 3345: TypeError: addon is null
1521607690370   addons.productaddons    INFO    sending request to: https://aus5.mozilla.org/update/3/GMP/59.0.1/20180315233128/WINNT_x86_64-msvc-x64/en-GB/release/Windows_NT%2010.0.0.0.16299.125%20(x64)/default/default/update.xml
1521607691520   addons.productaddons    INFO    Completed downloading document
1521607692630   addons.productaddons    INFO    downloadXHR File download. status=200
1521607692638   addons.productaddons    INFO    Downloaded file will be saved to C:\Users\DEEPAK~1\AppData\Local\Temp\tmpaddon-c492c1
1521607698968   addons.productaddons    INFO    downloadXHR File download. status=200
1521607698976   addons.productaddons    INFO    Downloaded file will be saved to C:\Users\DEEPAK~1\AppData\Local\Temp\tmpaddon-47ef79

Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'xxx', ip: '192.168.43.34', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_40'
Driver info: driver.version: FirefoxDriver
    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:134)
    at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:117)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:207)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
    at tests.firstTest.main(firstTest.java:22)
Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
driver@googlecode.com
1521607670798   addons.xpi  DEBUG   Ignoring file entry whose name is not a valid add-on ID: C:\Users\DEEPAK D P\AppData\Local\Temp\anonymous4306519380516409248webdriver-profile\extensions\webdriver-staging
1521607670798   addons.xpi  DEBUG   Existing add-on fxdriver@googlecode.com in app-profile

阅读 318

收藏
2020-06-26

共1个答案

一尘不染

错误说明了一切:

Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'xxx', ip: '192.168.43.34', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_40'
Driver info: driver.version: FirefoxDriver

错误跟踪日志明确提到 浏览器客户端 无法识别回 FirefoxDriver 二进制文件。

您的主要问题是所使用的二进制文件之间的 版本兼容性 ,如下所示:

  • 您的 Selenium Client 版本是 2015年10月9日19:59:122.48.2 ,这几乎快了 2 . 5年
  • 您的 JDK版本1.8.0_40 ,这非常古老。
  • 知道您的 GeckoDriver 版本。
  • 我们不知道您的 Firefox 版本。

因此, JDK v8u40Selenium Client v2.48.2 之间显然存在不匹配。

  • JDK 升级到最新级别的 JDK 8u162
  • Selenium 升级到当前 版本3.11.0
  • 升级 GeckoDriver GeckoDriver v0.20.0 水平。
  • Firefox 版本升级到 Firefox v59.0.1 级别。
  • 清理 你的 项目工作 ,通过你的 IDE重建 仅需要依赖你的项目。
  • 在执行 测试套件 之前和之后,使用 CCleaner 工具清除所有操作系统琐事。 __
  • 如果您的基本 Firefox 基本版本太旧,请通过 Revo Uninstaller 卸载它,并安装最新的GA和 Firefox 发行版。
  • 执行您的@Test
2020-06-26