[英]Firefox is getting failed on startup very first time with error connection refused
When I am running Firefox
driver, very first time it's getting failed after that it's working fine on every run. 当我运行Firefox
驱动程序时,它第一次出现故障之后,在每次运行中都运行良好。
This is happening by following way : 这是通过以下方式发生的:
org.openqa.selenium.WebDriverException: connection refused Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53' System info: host: 'SAURABH-PC', ip: '192.168.3.8', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_161' Driver info: driver.version: unknown remote stacktrace: Command duration or timeout: 66.09 seconds at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166) at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$errorHandler$0(JsonWireProtocolResponse.java:54) at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30) at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958) at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126) at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77) at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:252)
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:49153/wd/hub"), capabilities);
Selenium-standalone.jar
运行Selenium-standalone.jar
命令 java -Dwebdriver.gecko.driver=<path-to-geckodriver>\geckodriver.exe -jar <path-to-selenium-server-standalone.jar>\selenium-server-standalone.jar -port 49153
Feb 06, 2019 6:29:24 PM org.openqa.selenium.remote.DesiredCapabilities firefox
INFO: Using `new FirefoxOptions()` is preferred to `DesiredCapabilities.firefox()`
Feb 06, 2019 6:29:44 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
"value":{"error":"unknown error","message":"connection refused","stacktrace":""}}
1549457898669 mozrunner::runner INFO Running command: "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\Saurabh\\AppData\\Local\\Temp\\rust_mozprofile.2UOp20Lx725Q"
1549457899002 geckodriver::marionette DEBUG Waiting 60s to connect to browser on 127.0.0.1:51325
1549457915749 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: resource://pdf.js/
1549457915749 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: about:reader*
1549457916114 Marionette TRACE Received observer notification profile-after-change
1549457917888 Marionette TRACE Received observer notification toplevel-window-ready
1549457918713 Marionette TRACE Received observer notification command-line-startup
1549457918714 Marionette TRACE Received observer notification nsPref:changed
1549457918714 Marionette DEBUG Init aborted (running=false, enabled=true, finalUIStartup=false)
1549457925550 Marionette TRACE Received observer notification toplevel-window-ready
1549457948093 Marionette TRACE Received observer notification sessionstore-windows-restored
1549457948093 Marionette TRACE Waiting until startup recorder finished recording startup scripts...
1549457959572 mozrunner::runner DEBUG Killing process 11516
Exiting due to channel error.
Exiting due to channel error.
1549457960997 webdriver::server DEBUG <- 500 Internal Server Error {"value":{"error":"unknown error","message":"connection refused","stacktrace":""}}
1549457965775 mozrunner::runner INFO Running command: "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\Saurabh\\AppData\\Local\\Temp\\rust_mozprofile.0d9kqn5LP57h"
1549457965997 geckodriver::marionette DEBUG Waiting 60s to connect to browser on 127.0.0.1:51620
1549457995244 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: resource://pdf.js/
1549457995245 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: about:reader*
1549457995902 Marionette TRACE Received observer notification profile-after-change
1549457998402 Marionette TRACE Received observer notification toplevel-window-ready
1549457998814 Marionette TRACE Received observer notification command-line-startup
1549457998814 Marionette TRACE Received observer notification nsPref:changed
1549457998814 Marionette DEBUG Init aborted (running=false, enabled=true, finalUIStartup=false)
This error message... 此错误消息...
org.openqa.selenium.WebDriverException: connection refused
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53' System info: host: 'SAURABH-PC', ip: '192.168.3.8', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_161' Driver info: driver.version: unknown
...implies that the GeckoDriver was unable to initiate/spawn a new WebBrowsing Session ie Firefox Browser session. ...暗示GeckoDriver无法启动/产生新的WebBrowsing会话,即Firefox浏览器会话。
Your main issue is the incompatibility between the version of the binaries you are using as follows: 您的主要问题是所使用的二进制版本之间的不兼容性 ,如下所示:
So there is a clear mismatch between the JDK v8u161 , Selenium Client v3.141.59 , GeckoDriver v0.24.0 and the Firefox Browser v65.0 因此, JDK v8u161 , Selenium Client v3.141.59 , GeckoDriver v0.24.0和Firefox Browser v65.0之间显然存在不匹配
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.