Selenium 2.46.0 org.openqa.selenium.firefox.NotConnectedException:45000 ms后无法在端口7055上连接到主机127.0.0.1。

时间:2017-04-12 21:42:00

标签: selenium firefox

我尝试在我的MAC上运行Selenium 2.46.0并使用Firefox 52时,通过实例化FirefoxDriver的新实例来获取以下异常

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
features/deployment-checker@mozilla.org.xpi
1492032549324   addons.xpi  DEBUG   Loading bootstrap scope from /Applications/Firefox.app/Contents/Resources/browser/features/deployment-checker@mozilla.org.xpi
1492032549330   addons.xpi  DEBUG   Calling bootstrap method startup on deployment-checker@mozilla.org version 1.0
1492032549330   addons.xpi  DEBUG   Registering manifest for /Applications/Firefox.app/Contents/Resources/browser/features/e10srollout@mozilla.org.xpi
1492032549330   addons.xpi  DEBUG   Loading bootstrap scope from /Applications/Firefox.app/Contents/Resources/browser/features/e10srollout@mozilla.org.xpi
1492032549331   addons.xpi  DEBUG   Calling bootstrap method startup on e10srollout@mozilla.org version 1.9
1492032549332   addons.xpi  DEBUG   Registering manifest for /Applications/Firefox.app/Contents/Resources/browser/features/firefox@getpocket.com.xpi
1492032549333   addons.xpi  DEBUG   Loading bootstrap scope from /Applications/Firefox.app/Contents/Resources/browser/features/firefox@getpocket.com.xpi
1492032549336   addons.xpi  DEBUG   Calling bootstrap method startup on firefox@getpocket.com version 1.0.5
1492032549342   addons.xpi-utils    DEBUG   Starting async load of XPI database /var/folders/ww/gv287wh16h1dc2_vfkbqhzzsljzc90/T/anonymous2050536623730480419webdriver-profile/extensions.json
1492032549343   addons.xpi  DEBUG   Registering manifest for /Applications/Firefox.app/Contents/Resources/browser/features/webcompat@mozilla.org.xpi
1492032549343   addons.xpi  DEBUG   Loading bootstrap scope from /Applications/Firefox.app/Contents/Resources/browser/features/webcompat@mozilla.org.xpi
1492032549344   addons.xpi  DEBUG   Calling bootstrap method startup on webcompat@mozilla.org version 1.0
1492032549347   addons.manager  DEBUG   Registering shutdown blocker for XPIProvider
1492032549347   addons.manager  DEBUG   Provider finished startup: XPIProvider
1492032549347   addons.manager  DEBUG   Starting provider: LightweightThemeManager
1492032549347   addons.manager  DEBUG   Registering shutdown blocker for LightweightThemeManager
1492032549347   addons.manager  DEBUG   Provider finished startup: LightweightThemeManager
1492032549347   addons.manager  DEBUG   Starting provider: GMPProvider
1492032549355   addons.manager  DEBUG   Registering shutdown blocker for GMPProvider
1492032549356   addons.manager  DEBUG   Provider finished startup: GMPProvider
1492032549356   addons.manager  DEBUG   Starting provider: PluginProvider
1492032549356   addons.manager  DEBUG   Registering shutdown blocker for PluginProvider
1492032549356   addons.manager  DEBUG   Provider finished startup: PluginProvider
1492032549357   addons.manager  DEBUG   Completed startup sequence
1492032549818   addons.xpi-utils    DEBUG   Async JSON file read took 0 MS
1492032549818   addons.xpi-utils    DEBUG   Finished async read of XPI database, parsing...
1492032549822   addons.xpi-utils    DEBUG   Successfully read XPI database
1492032549843   addons.manager  DEBUG   Starting provider: <unnamed-provider>
1492032549843   addons.manager  DEBUG   Registering shutdown blocker for <unnamed-provider>
1492032549844   addons.manager  DEBUG   Provider finished startup: <unnamed-provider>
*** Blocklist::_loadBlocklistFromFile: blocklist is disabled
1492032549976   addons.manager  DEBUG   Starting provider: PreviousExperimentProvider
1492032549976   addons.manager  DEBUG   Registering shutdown blocker for PreviousExperimentProvider
1492032549977   addons.manager  DEBUG   Provider finished startup: PreviousExperimentProvider
2017-04-12 14:29:11.058 plugin-container[31127:15159940] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x933f, name = 'com.apple.tsm.portname'
See /usr/include/servers/bootstrap_defs.h for the error codes.
2017-04-12 14:29:11.060 plugin-container[31127:15159940] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x4f17, name = 'com.apple.CFPasteboardClient'
See /usr/include/servers/bootstrap_defs.h for the error codes.
2017-04-12 14:29:11.060 plugin-container[31127:15159940] void __CFPasteboardSetup() : Failed to allocate communication port for com.apple.CFPasteboardClient; this is likely due to sandbox restrictions

    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118)
    at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:119)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:191)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:99)
    at com.cobaltgroup.websites.kpi.BaseKPILeads$KpiWebDriverFactory.createLocalWebDriver(BaseKPILeads.java:156)
    at com.cobaltgroup.websites.kpi.BaseKPILeads.setup(BaseKPILeads.java:91)
    at com.cobaltgroup.websites.kpi.kia.KiaLeadSubmissionTest.setUp(KiaLeadSubmissionTest.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at com.saucelabs.junit.ConcurrentParameterized$SauceClassRunnerForParameters.access$300(ConcurrentParameterized.java:170)
    at com.saucelabs.junit.ConcurrentParameterized$SauceClassRunnerForParameters$2.run(ConcurrentParameterized.java:287)
    at com.saucelabs.junit.ConcurrentParameterized$NonBlockingAsynchronousRunner$1.call(ConcurrentParameterized.java:312)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(/Applications/Firefox.app/Contents/MacOS/firefox-bin) on port 7055; process output follows: 
features/deployment-checker@mozilla.org.xpi
1492032549324   addons.xpi  DEBUG   Loading bootstrap scope from /Applications/Firefox.app/Contents/Resources/browser/features/deployment-checker@mozilla.org.xpi
1492032549330   addons.xpi  DEBUG   Calling bootstrap method startup on deployment-checker@mozilla.org version 1.0
1492032549330   addons.xpi  DEBUG   Registering manifest for /Applications/Firefox.app/Contents/Resources/browser/features/e10srollout@mozilla.org.xpi
1492032549330   addons.xpi  DEBUG   Loading bootstrap scope from /Applications/Firefox.app/Contents/Resources/browser/features/e10srollout@mozilla.org.xpi
1492032549331   addons.xpi  DEBUG   Calling bootstrap method startup on e10srollout@mozilla.org version 1.9
1492032549332   addons.xpi  DEBUG   Registering manifest for /Applications/Firefox.app/Contents/Resources/browser/features/firefox@getpocket.com.xpi
1492032549333   addons.xpi  DEBUG   Loading bootstrap scope from /Applications/Firefox.app/Contents/Resources/browser/features/firefox@getpocket.com.xpi
1492032549336   addons.xpi  DEBUG   Calling bootstrap method startup on firefox@getpocket.com version 1.0.5
1492032549342   addons.xpi-utils    DEBUG   Starting async load of XPI database /var/folders/ww/gv287wh16h1dc2_vfkbqhzzsljzc90/T/anonymous2050536623730480419webdriver-profile/extensions.json
1492032549343   addons.xpi  DEBUG   Registering manifest for /Applications/Firefox.app/Contents/Resources/browser/features/webcompat@mozilla.org.xpi
1492032549343   addons.xpi  DEBUG   Loading bootstrap scope from /Applications/Firefox.app/Contents/Resources/browser/features/webcompat@mozilla.org.xpi
1492032549344   addons.xpi  DEBUG   Calling bootstrap method startup on webcompat@mozilla.org version 1.0
1492032549347   addons.manager  DEBUG   Registering shutdown blocker for XPIProvider
1492032549347   addons.manager  DEBUG   Provider finished startup: XPIProvider
1492032549347   addons.manager  DEBUG   Starting provider: LightweightThemeManager
1492032549347   addons.manager  DEBUG   Registering shutdown blocker for LightweightThemeManager
1492032549347   addons.manager  DEBUG   Provider finished startup: LightweightThemeManager
1492032549347   addons.manager  DEBUG   Starting provider: GMPProvider
1492032549355   addons.manager  DEBUG   Registering shutdown blocker for GMPProvider
1492032549356   addons.manager  DEBUG   Provider finished startup: GMPProvider
1492032549356   addons.manager  DEBUG   Starting provider: PluginProvider
1492032549356   addons.manager  DEBUG   Registering shutdown blocker for PluginProvider
1492032549356   addons.manager  DEBUG   Provider finished startup: PluginProvider
1492032549357   addons.manager  DEBUG   Completed startup sequence
1492032549818   addons.xpi-utils    DEBUG   Async JSON file read took 0 MS
1492032549818   addons.xpi-utils    DEBUG   Finished async read of XPI database, parsing...
1492032549822   addons.xpi-utils    DEBUG   Successfully read XPI database
1492032549843   addons.manager  DEBUG   Starting provider: <unnamed-provider>
1492032549843   addons.manager  DEBUG   Registering shutdown blocker for <unnamed-provider>
1492032549844   addons.manager  DEBUG   Provider finished startup: <unnamed-provider>
*** Blocklist::_loadBlocklistFromFile: blocklist is disabled
1492032549976   addons.manager  DEBUG   Starting provider: PreviousExperimentProvider
1492032549976   addons.manager  DEBUG   Registering shutdown blocker for PreviousExperimentProvider
1492032549977   addons.manager  DEBUG   Provider finished startup: PreviousExperimentProvider
2017-04-12 14:29:11.058 plugin-container[31127:15159940] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x933f, name = 'com.apple.tsm.portname'
See /usr/include/servers/bootstrap_defs.h for the error codes.
2017-04-12 14:29:11.060 plugin-container[31127:15159940] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x4f17, name = 'com.apple.CFPasteboardClient'
See /usr/include/servers/bootstrap_defs.h for the error codes.
2017-04-12 14:29:11.060 plugin-container[31127:15159940] void __CFPasteboardSetup() : Failed to allocate communication port for com.apple.CFPasteboardClient; this is likely due to sandbox restrictions

Build info: version: '2.49.1', revision: '808c23b0963853d375cbe54b90bbd052e2528a54', time: '2016-01-21 09:37:52'
System info: host: 'sea-meahm-m1.ds.ad.adp.com', ip: '127.0.0.1', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '1.7.0_79'
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:246)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:119)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:191)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:99)
    at com.cobaltgroup.websites.kpi.BaseKPILeads$KpiWebDriverFactory.createLocalWebDriver(BaseKPILeads.java:156)
    at com.cobaltgroup.websites.kpi.BaseKPILeads.setup(BaseKPILeads.java:91)
    at com.cobaltgroup.websites.kpi.kia.KiaLeadSubmissionTest.setUp(KiaLeadSubmissionTest.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at com.saucelabs.junit.ConcurrentParameterized$SauceClassRunnerForParameters.access$300(ConcurrentParameterized.java:170)
    at com.saucelabs.junit.ConcurrentParameterized$SauceClassRunnerForParameters$2.run(ConcurrentParameterized.java:287)
    at com.saucelabs.junit.ConcurrentParameterized$NonBlockingAsynchronousRunner$1.call(ConcurrentParameterized.java:312)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

我发现降级我的FF的建议,是否有比这更好的解决方案?

1 个答案:

答案 0 :(得分:2)

维护驱动程序的所有权已转向浏览器本身,因为已经开始向w3标准添加驱动程序支持

这意味着 selenium 不再维护驱动程序,并且您无法使用内置的 selenium驱动程序较旧的 webdriver 版本,可以运行最新的 firefox 版本。

相反,如果您想要可靠地使用最新的浏览器,您必须从 Mozilla 下载相关的驱动程序,在本例中为 geckodriver

这需要一些配置,不幸的是,在浏览器支持驱动程序的过渡期间出现了一些障碍,但事情开始趋于稳定并且工作得更好。

您唯一的另一种选择是您在问题中提到的那个,您可以将 firefox 的版本降级到支持 Selenium 2.46.0 的版本。