浏览器打开,但似乎初始化无法返回驱动程序的实例。最初我只是尝试使用Selenium附带的默认firefox驱动程序,但是在网上冲浪我发现了一个可能的解决方案,使用gecko驱动程序并设置所需的功能到木偶。但我仍然会得到同样的问题,详情如下:
环境详情:
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 fxdriver@googlecode.com to /var/folders/9p/2htxqw413p57h8nlv3mzk0w96r_3bp/T/anonymous2657944051650289643webdriver-profile/extensions/fxdriver@googlecode.com
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 fxdriver@googlecode.com in app-profile
1506807895926 addons.xpi INFO Mapping aushelper@mozilla.org to /Applications/Firefox.app/Contents/Resources/browser/features/aushelper@mozilla.org.xpi
1506807895927 addons.xpi INFO Mapping clicktoplay-rollout@mozilla.org to /Applications/Firefox.app/Contents/Resources/browser/features/clicktoplay-rollout@mozilla.org.xpi
1506807895928 addons.xpi INFO Mapping e10srollout@mozilla.org to /Applications/Firefox.app/Contents/Resources/browser/features/e10srollout@mozilla.org.xpi
1506807895928 addons.xpi INFO Mapping firefox@getpocket.com to /Applications/Firefox.app/Contents/Resources/browser/features/firefox@getpocket.com.xpi
1506807895928 addons.xpi INFO Mapping followonsearch@mozilla.com to /Applications/Firefox.app/Contents/Resources/browser/features/followonsearch@mozilla.com.xpi
1506807895928 addons.xpi INFO Mapping screenshots@mozilla.org to /Applications/Firefox.app/Contents/Resources/browser/features/screenshots@mozilla.org.xpi
1506807895928 addons.xpi INFO Mapping shield-recipe-client@mozilla.org to /Applications/Firefox.app/Contents/Resources/browser/features/shield-recipe-client@mozilla.org.xpi
1506807895928 addons.xpi INFO Mapping webcompat@mozilla.org to /Applications/Firefox.app/Contents/Resources/browser/features/webcompat@mozilla.org.xpi
1506807895928 addons.xpi DEBUG Existing add-on aushelper@mozilla.org in app-system-defaults
1506807895929 addons.xpi DEBUG Existing add-on clicktoplay-rollout@mozilla.org in app-system-defaults
1506807895929 addons.xpi DEBUG Existing add-on e10srollout@mozilla.org in app-system-defaults
1506807895929 addons.xpi DEBUG Existing add-on firefox@getpocket.com in app-system-defaults
1506807895929 addons.xpi DEBUG Existing add-on followonsearch@mozilla.com in app-system-defaults
1506807895930 addons.xpi DEBUG Existing add-on screenshots@mozilla.org in app-system-defaults
1506807895930 addons.xpi DEBUG Existing add-on shield-recipe-client@mozilla.org in app-system-defaults
1506807895930 addons.xpi DEBUG Existing add-on webcompat@mozilla.org 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 :(得分:0)
我认为你必须更新你的硒罐,因为你正在使用ff 55.0并且还要更新geckodriver
geckodriver的链接:https://github.com/mozilla/geckodriver/releases
selenium jar的链接:http://www.seleniumhq.org/download/
尝试一次,如果您有任何疑虑,请告诉我