无法在Mozilla Firefox浏览器中运行selenium代码

时间:2015-02-10 06:12:42

标签: selenium-webdriver

在FireFox浏览器运行脚本时,在页面上出现以下错误,请建议如何继续。

FireFox版本 - 32.0.3 Eclipse Juno版本1 硒2.38罐子 Window 8 Version

Error message throwing in the console is :
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
eferredSave.extensions.json DEBUG   Starting write
1423547733710   addons.xpi  DEBUG   shutdown
1423547733710   addons.xpi-utils    DEBUG   shutdown
1423547733764   DeferredSave.extensions.json    DEBUG   Write succeeded
1423547733764   addons.xpi-utils    DEBUG   XPI Database saved, setting schema version preference to 16
1423547733764   addons.xpi  DEBUG   Notifying XPI shutdown observers
1423547733767   addons.manager  DEBUG   Async provider shutdown done
1423547734167   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/addons/XPIProvider.jsm: ["XPIProvider"]
1423547734168   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/LightweightThemeManager.jsm: ["LightweightThemeManager"]
1423547734169   addons.xpi  DEBUG   startup
1423547734170   addons.xpi  DEBUG   Skipping unavailable install location app-system-local
1423547734170   addons.xpi  DEBUG   Skipping unavailable install location app-system-share
1423547734171   addons.xpi  INFO    Mapping {82AF8DCA-6DE9-405D-BD5E-43525BDAD38A} to C:\Program Files (x86)\Mozilla Firefox\browser\extensions\{82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}.xpi
1423547734171   addons.xpi  INFO    Mapping {972ce4c6-7e08-4474-a285-3208198ce6fd} to C:\Program Files (x86)\Mozilla Firefox\browser\extensions\{972ce4c6-7e08-4474-a285-3208198ce6fd}
1423547734173   addons.xpi  INFO    Mapping fxdriver@googlecode.com to C:\Users\PREMAN~1.S\AppData\Local\Temp\anonymous1824976243334194970webdriver-profile\extensions\fxdriver@googlecode.com
1423547734173   addons.xpi  DEBUG   Ignoring file entry whose name is not a valid add-on ID: C:\Users\PREMAN~1.S\AppData\Local\Temp\anonymous1824976243334194970webdriver-profile\extensions\webdriver-staging
1423547734173   addons.xpi  DEBUG   checkForChanges
1423547734195   addons.xpi  DEBUG   No changes found
1423547734199   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\extensions\{82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}.xpi
1423547734199   addons.xpi  DEBUG   Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\extensions\{82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}.xpi
1423547734205   addons.xpi  DEBUG   Calling bootstrap method startup on {82AF8DCA-6DE9-405D-BD5E-43525BDAD38A} version 7.2.15747.10003
*** Blocklist::_preloadBlocklistFile: blocklist is disabled
console.error: skype_ff_extension: 
  DEPRECATED: The widget module is deprecated.  Please consider using the sdk/ui module instead.
Traceback (most recent call last):
  File "resource://gre/modules/commonjs/sdk/addon/runner.js", line 114, in startup/<
    run(options);
  File "resource://gre/modules/commonjs/sdk/addon/runner.js", line 170, in run
    let program = main(options.loader, options.main);
  File "resource://gre/modules/commonjs/toolkit/loader.js", line 645, in main
    return loader.load(loader, module).exports;
  File "resource://gre/modules/commonjs/sdk/loader/cuddlefish.js", line 129, in CuddlefishLoader/options<.load
    result = load(loader, module);
  File "resource://gre/modules/commonjs/toolkit/loader.js", line 299, in load
    evaluate(sandbox, module.uri);
  File "resource://gre/modules/commonjs/toolkit/loader.js", line 262, in evaluate
    : loadSubScript(uri, sandbox, encoding);
  File "resource://skype_ff_extension-at-jetpack/skype_ff_extension/lib/main.js", line 14, in null
    var widgets = require("sdk/widget");
  File "resource://gre/modules/commonjs/toolkit/loader.js", line 619, in require
    freeze(load(loader, module));
  File "resource://gre/modules/commonjs/sdk/loader/cuddlefish.js", line 129, in CuddlefishLoader/options<.load
    result = load(loader, module);
  File "resource://gre/modules/commonjs/toolkit/loader.js", line 299, in load
    evaluate(sandbox, module.uri);
  File "resource://gre/modules/commonjs/toolkit/loader.js", line 262, in evaluate
    : loadSubScript(uri, sandbox, encoding);
  File "resource://gre/modules/commonjs/sdk/widget.js", line 60, in null
    "The widget module is deprecated.  " +
  File "resource://gre/modules/commonjs/sdk/util/deprecate.js", line 18, in deprecateUsage
    let stack = get().slice(2);

    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118)
    at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:250)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:110)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:197)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:190)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:99)
    at Demo.SetupTest(Demo.java:25)
    at Demo.main(Demo.java:19)
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: 
eferredSave.extensions.json DEBUG   Starting write
1423547733710   addons.xpi  DEBUG   shutdown
1423547733710   addons.xpi-utils    DEBUG   shutdown
1423547733764   DeferredSave.extensions.json    DEBUG   Write succeeded
1423547733764   addons.xpi-utils    DEBUG   XPI Database saved, setting schema version preference to 16
1423547733764   addons.xpi  DEBUG   Notifying XPI shutdown observers
1423547733767   addons.manager  DEBUG   Async provider shutdown done
1423547734167   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/addons/XPIProvider.jsm: ["XPIProvider"]
1423547734168   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/LightweightThemeManager.jsm: ["LightweightThemeManager"]
1423547734169   addons.xpi  DEBUG   startup
1423547734170   addons.xpi  DEBUG   Skipping unavailable install location app-system-local
1423547734170   addons.xpi  DEBUG   Skipping unavailable install location app-system-share
1423547734171   addons.xpi  INFO    Mapping {82AF8DCA-6DE9-405D-BD5E-43525BDAD38A} to C:\Program Files (x86)\Mozilla Firefox\browser\extensions\{82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}.xpi
1423547734171   addons.xpi  INFO    Mapping {972ce4c6-7e08-4474-a285-3208198ce6fd} to C:\Program Files (x86)\Mozilla Firefox\browser\extensions\{972ce4c6-7e08-4474-a285-3208198ce6fd}
1423547734173   addons.xpi  INFO    Mapping fxdriver@googlecode.com to C:\Users\PREMAN~1.S\AppData\Local\Temp\anonymous1824976243334194970webdriver-profile\extensions\fxdriver@googlecode.com
1423547734173   addons.xpi  DEBUG   Ignoring file entry whose name is not a valid add-on ID: C:\Users\PREMAN~1.S\AppData\Local\Temp\anonymous1824976243334194970webdriver-profile\extensions\webdriver-staging
1423547734173   addons.xpi  DEBUG   checkForChanges
1423547734195   addons.xpi  DEBUG   No changes found
1423547734199   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\extensions\{82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}.xpi
1423547734199   addons.xpi  DEBUG   Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\extensions\{82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}.xpi
1423547734205   addons.xpi  DEBUG   Calling bootstrap method startup on {82AF8DCA-6DE9-405D-BD5E-43525BDAD38A} version 7.2.15747.10003
*** Blocklist::_preloadBlocklistFile: blocklist is disabled
console.error: skype_ff_extension: 
  DEPRECATED: The widget module is deprecated.  Please consider using the sdk/ui module instead.
Traceback (most recent call last):
  File "resource://gre/modules/commonjs/sdk/addon/runner.js", line 114, in startup/<
    run(options);
  File "resource://gre/modules/commonjs/sdk/addon/runner.js", line 170, in run
    let program = main(options.loader, options.main);
  File "resource://gre/modules/commonjs/toolkit/loader.js", line 645, in main
    return loader.load(loader, module).exports;
  File "resource://gre/modules/commonjs/sdk/loader/cuddlefish.js", line 129, in CuddlefishLoader/options<.load
    result = load(loader, module);
  File "resource://gre/modules/commonjs/toolkit/loader.js", line 299, in load
    evaluate(sandbox, module.uri);
  File "resource://gre/modules/commonjs/toolkit/loader.js", line 262, in evaluate
    : loadSubScript(uri, sandbox, encoding);
  File "resource://skype_ff_extension-at-jetpack/skype_ff_extension/lib/main.js", line 14, in null
    var widgets = require("sdk/widget");
  File "resource://gre/modules/commonjs/toolkit/loader.js", line 619, in require
    freeze(load(loader, module));
  File "resource://gre/modules/commonjs/sdk/loader/cuddlefish.js", line 129, in CuddlefishLoader/options<.load
    result = load(loader, module);
  File "resource://gre/modules/commonjs/toolkit/loader.js", line 299, in load
    evaluate(sandbox, module.uri);
  File "resource://gre/modules/commonjs/toolkit/loader.js", line 262, in evaluate
    : loadSubScript(uri, sandbox, encoding);
  File "resource://gre/modules/commonjs/sdk/widget.js", line 60, in null
    "The widget module is deprecated.  " +
  File "resource://gre/modules/commonjs/sdk/util/deprecate.js", line 18, in deprecateUsage
    let stack = get().slice(2);

Build info: version: '2.38.0', revision: 'bd32d4e', time: '2013-12-05 16:16:40'
System info: host: 'EXIND3917', ip: '10.90.3.134', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_29'
Driver info: driver.version: FirefoxDriver
    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:130)
    at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:250)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:110)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:197)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:190)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:99)
    at Demo.SetupTest(Demo.java:25)
    at Demo.main(Demo.java:19)
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:
eferredSave.extensions.json DEBUG   Starting write
1423547733710   addons.xpi  DEBUG   shutdown
1423547733710   addons.xpi-utils    DEBUG   shutdown
1423547733764   DeferredSave.extensions.json    DEBUG   Write succeeded
1423547733764   addons.xpi-utils    DEBUG   XPI Database saved, setting schema version preference to 16
1423547733764   addons.xpi  DEBUG   Notifying XPI shutdown observers
1423547733767   addons.manager  DEBUG   Async provider shutdown done
1423547734167   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/addons/XPIProvider.jsm: ["XPIProvider"]
1423547734168   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/LightweightThemeManager.jsm: ["LightweightThemeManager"]
1423547734169   addons.xpi  DEBUG   startup
1423547734170   addons.xpi  DEBUG   Skipping unavailable install location app-system-local
1423547734170   addons.xpi  DEBUG   Skipping unavailable install location app-system-share
1423547734171   addons.xpi  INFO    Mapping {82AF8DCA-6DE9-405D-BD5E-43525BDAD38A} to C:\Program Files (x86)\Mozilla Firefox\browser\extensions\{82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}.xpi
1423547734171   addons.xpi  INFO    Mapping {972ce4c6-7e08-4474-a285-3208198ce6fd} to C:\Program Files (x86)\Mozilla Firefox\browser\extensions\{972ce4c6-7e08-4474-a285-3208198ce6fd}
1423547734173   addons.xpi  INFO    Mapping fxdriver@googlecode.com to C:\Users\PREMAN~1.S\AppData\Local\Temp\anonymous1824976243334194970webdriver-profile\extensions\fxdriver@googlecode.com
1423547734173   addons.xpi  DEBUG   Ignoring file entry whose name is not a valid add-on ID: C:\Users\PREMAN~1.S\AppData\Local\Temp\anonymous1824976243334194970webdriver-profile\extensions\webdriver-staging
1423547734173   addons.xpi  DEBUG   checkForChanges
1423547734195   addons.xpi  DEBUG   No changes found
1423547734199   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\extensions\{82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}.xpi
1423547734199   addons.xpi  DEBUG   Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\extensions\{82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}.xpi
1423547734205   addons.xpi  DEBUG   Calling bootstrap method startup on {82AF8DCA-6DE9-405D-BD5E-43525BDAD38A} version 7.2.15747.10003
*** Blocklist::_preloadBlocklistFile: blocklist is disabled
console.error: skype_ff_extension: 
  DEPRECATED: The widget module is deprecated.  Please consider using the sdk/ui module instead.
Traceback (most recent call last):
  File "resource://gre/modules/commonjs/sdk/addon/runner.js", line 114, in startup/<
    run(options);
  File "resource://gre/modules/commonjs/sdk/addon/runner.js", line 170, in run
    let program = main(options.loader, options.main);
  File "resource://gre/modules/commonjs/toolkit/loader.js", line 645, in main
    return loader.load(loader, module).exports;
  File "resource://gre/modules/commonjs/sdk/loader/cuddlefish.js", line 129, in CuddlefishLoader/options<.load
    result = load(loader, module);
  File "resource://gre/modules/commonjs/toolkit/loader.js", line 299, in load
    evaluate(sandbox, module.uri);
  File "resource://gre/modules/commonjs/toolkit/loader.js", line 262, in evaluate
    : loadSubScript(uri, sandbox, encoding);
  File "resource://skype_ff_extension-at-jetpack/skype_ff_extension/lib/main.js", line 14, in null
    var widgets = require("sdk/widget");
  File "resource://gre/modules/commonjs/toolkit/loader.js", line 619, in require
    freeze(load(loader, module));
  File "resource://gre/modules/commonjs/sdk/loader/cuddlefish.js", line 129, in CuddlefishLoader/options<.load
    result = load(loader, module);
  File "resource://gre/modules/commonjs/toolkit/loader.js", line 299, in load
    evaluate(sandbox, module.uri);
  File "resource://gre/modules/commonjs/toolkit/loader.js", line 262, in evaluate
    : loadSubScript(uri, sandbox, encoding);
  File "resource://gre/modules/commonjs/sdk/widget.js", line 60, in null
    "The widget module is deprecated.  " +
  File "resource://gre/modules/commonjs/sdk/util/deprecate.js", line 18, in deprecateUsage
    let stack = get().slice(2);

    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118)

请告诉我哪里出错?

4 个答案:

答案 0 :(得分:0)

尝试使用更新的Selenium Jar文件。同时关闭FF的所有实例并清除%temp%文件夹。

答案 1 :(得分:0)

尝试更新POM.XML中的selenium

<dependencies>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.40.0</version>
    </dependency>

答案 2 :(得分:0)

Selenium 1.x联合创始人。从http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.seleniumhq.selenium%22%20AND%20a%3A%22selenium-server%22中选择Selenium依赖项的最大数字。现在是2.44。可能是

答案 3 :(得分:0)

您需要恢复到Firefox 34.0b11 这是与Selenium WebDriver 2.43.1

一起使用的最新版本

1)从控制面板卸载Firefox

2)从程序文件(x86)手动删除Firefox目录 *重要*

3)使用自定义安装设置从下面的链接安装FireFox,并取消选中无声更新选项

这可以防止FireFox将自己更新为杀死WebDriver的下一个版本。它与FunnelCake32有关,虽然我不知道到底发生了什么。

http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/34.0b11/win32/