2017-09-30 110 views
-1

浏览器打开,但似乎初始化无法返回驱动程序的实例。最初我只是试图使用Selenium附带的默认firefox驱动程序,但是在网上冲浪时,我使用壁虎驱动程序找到了一个可能的解决方案,并将所需功能设置为牵线木偶。但我仍然得到同样的问题,具体如下:使用Firefox在MacOs上运行Web测试的问题:无法在45000 ms后在端口7055上连接到主机127.0.0.1。 Firefox控制台输出:

环境细节:

OS: macOs Sierra, 10.12.6 
Browser: Firefox --> 55.0.3 (64-bit) 
Driver: geckodriver 
Selenium: 2.53.0 

堆栈跟踪:

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: 
ager DEBUG Registering shutdown blocker for <unnamed-provider> 
1506807895921 addons.manager DEBUG Provider finished startup: <unnamed-provider> 
1506807895924 addons.xpi INFO Mapping [email protected] to /var/folders/9p/2htxqw413p57h8nlv3mzk0w96r_3bp/T/anonymous2657944051650289643webdriver-profile/extensions/[email protected] 
1506807895925 addons.xpi DEBUG Ignoring file entry whose name is not a valid add-on ID: /var/folders/9p/2htxqw413p57h8nlv3mzk0w96r_3bp/T/anonymous2657944051650289643webdriver-profile/extensions/webdriver-staging 
1506807895925 addons.xpi DEBUG Existing add-on [email protected] in app-profile 
1506807895926 addons.xpi INFO Mapping [email protected] to /Applications/Firefox.app/Contents/Resources/browser/features/[email protected] 
1506807895927 addons.xpi INFO Mapping [email protected] to /Applications/Firefox.app/Contents/Resources/browser/features/[email protected] 
1506807895928 addons.xpi INFO Mapping [email protected] to /Applications/Firefox.app/Contents/Resources/browser/features/[email protected] 
1506807895928 addons.xpi INFO Mapping [email protected] to /Applications/Firefox.app/Contents/Resources/browser/features/[email protected] 
1506807895928 addons.xpi INFO Mapping [email protected] to /Applications/Firefox.app/Contents/Resources/browser/features/[email protected] 
1506807895928 addons.xpi INFO Mapping [email protected] to /Applications/Firefox.app/Contents/Resources/browser/features/[email protected] 
1506807895928 addons.xpi INFO Mapping [email protected] to /Applications/Firefox.app/Contents/Resources/browser/features/[email protected] 
1506807895928 addons.xpi INFO Mapping [email protected] to /Applications/Firefox.app/Contents/Resources/browser/features/[email protected] 
1506807895928 addons.xpi DEBUG Existing add-on [email protected] in app-system-defaults 
1506807895929 addons.xpi DEBUG Existing add-on [email protected] in app-system-defaults 
1506807895929 addons.xpi DEBUG Existing add-on [email protected] in app-system-defaults 
1506807895929 addons.xpi DEBUG Existing add-on [email protected] in app-system-defaults 
1506807895929 addons.xpi DEBUG Existing add-on [email protected] in app-system-defaults 
1506807895930 addons.xpi DEBUG Existing add-on [email protected] in app-system-defaults 
1506807895930 addons.xpi DEBUG Existing add-on [email protected] in app-system-defaults 
1506807895930 addons.xpi DEBUG Existing add-on [email protected] in app-system-defaults 
1506807895930 addons.xpi INFO Mapping {972ce4c6-7e08-4474-a285-3208198ce6fd} to /Applications/Firefox.app/Contents/Resources/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi 
1506807895931 addons.xpi DEBUG Existing add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} in app-global 
1506807895931 addons.xpi DEBUG getInstallState changed: false, state: {} 
2017-09-30 14:44:56.051 firefox-bin[44193:336169] IMKInputSession presentFunctionRowItemTextInputViewWithEndpoint:completionHandler: : [self textInputContext]=0x12826f3a0 *NO* NSRemoteViewController to client, NSError=Error Domain=NSCocoaErrorDomain Code=4097 "connection from pid 0" UserInfo={NSDebugDescription=connection from pid 0}, com.apple.inputmethod.EmojiFunctionRowItem 
1506807896108 addons.productaddons INFO sending request to: https://aus5.mozilla.org/update/3/GMP/55.0.3/20170824053838/Darwin_x86_64-gcc3/en-US/release/Darwin%2016.7.0/default/default/update.xml 
1506807896377 addons.productaddons INFO Completed downloading document 
1506807896775 addons.productaddons INFO downloadXHR File download. status=200 
1506807896784 addons.productaddons INFO Downloaded file will be saved to /var/folders/9p/2htxqw413p57h8nlv3mzk0w96r_3bp/T/tmpaddon 
1506807897933 addons.productaddons INFO downloadXHR File download. status=200 
1506807897936 addons.productaddons INFO Downloaded file will be saved to /var/folders/9p/2htxqw413p57h8nlv3mzk0w96r_3bp/T/tmpaddon 

    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:113) 
    at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271) 
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:119) 
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:216) 
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211) 
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:128) 
    at com.move.lead.allocation.CommonTestBase.initialize(CommonTestBase.java:68) 
    at com.move.lead.allocation.api.ApiTestBase.testExceutionPreChecks(ApiTestBase.java:89) 
    at com.move.lead.allocation.api.ApiTestBase.intializetestMethod(ApiTestBase.java:73) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:498) 
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104) 
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:515) 
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:217) 
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:590) 
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:851) 
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1177) 
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129) 
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112) 
    at org.testng.TestRunner.privateRun(TestRunner.java:756) 
    at org.testng.TestRunner.run(TestRunner.java:610) 
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:387) 
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:382) 
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340) 
    at org.testng.SuiteRunner.run(SuiteRunner.java:289) 
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) 
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) 
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1293) 
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1218) 
    at org.testng.TestNG.runSuites(TestNG.java:1133) 
    at org.testng.TestNG.run(TestNG.java:1104) 
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132) 
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230) 
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76) 
+0

请仔细阅读[问],特别是关于[MCVE(MCVE)的一部分,和[如何预计会有很多研究工作吗?](https://meta.stackoverflow.com/questions/261592/how-much-research-effort-is-expected-of-stack-overflow-users)这将帮助你调试你自己的程序并为自己解决问题。如果你这样做并且仍然卡住,你可以回过头来发布你的MCVE,你试过的,以及执行结果,包括任何错误信息,这样我们可以更好地帮助你。还提供了一个链接到页面和/或相关的HTML。 – JeffC

回答

相关问题