简体   繁体   English

无法使用Selenium 3.0.0-beta3与Geckodriver启动Firefox 41

[英]Failed to launch Firefox 41 with Geckodriver using Selenium 3.0.0-beta3

I was running some quick tests using WebDriver . 我正在使用WebDriver运行一些快速测试。 I downlowded the FirefoxWebDriver and the ChromeWebDriver ; 我调低了FirefoxWebDriverChromeWebDriver ; geckodriver-v0.10.0-win64.zip and chromedriver_win32.zip . geckodriver-v0.10.0-win64.zipchromedriver_win32.zip

They are extracted to a path location and have been renamed accordingly; 它们被提取到路径位置,并已相应重命名; wires.exe and chromedriver.exe respectively. wires.exechromedriver.exe

When I created my test, did as follows: 创建测试时,请执行以下操作:

DesiredCapabilities cap = DesiredCapabilities.firefox();
cap.setCapability("marionette", true);
WebDriver driver = new FirefoxDriver(cap);

//WebDriver driver = new ChromeDriver(DeesiredCapabilities.chrome());

and for Firefox , it failed to create a session (and failed the tests), where-as chrome succeeded and then passed the tests. 对于Firefox ,它无法创建会话(并且测试失败),而chrome成功后又通过了测试。

The Output from the test is as follows: 测试的输出如下:

 Sep 28, 2016 2:51:32 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end Sep 28, 2016 2:51:38 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Falling back to straight W3C remote end connection Sep 28, 2016 2:51:44 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Falling back to original OSS JSON Wire Protocol. org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Build info: version: 'unknown', revision: 'c7b525d', time: '2016-09-01 14:57:44 -0700' System info: host: 'CHI-CS-55DXX52', ip: '10.60.68.15', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_77' Driver info: driver.version: FirefoxDriver at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:618) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129) at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:231) at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:219) at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:214) at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:131) at com.polymerdart.webdriver.MyFirstTest.startWebDriver(MyFirstTest.java:21) 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84) 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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) Caused by: org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, browserName=firefox, version=, platform=ANY}], required capabilities = Capabilities [{}] Build info: version: 'unknown', revision: 'c7b525d', time: '2016-09-01 14:57:44 -0700' System info: host: 'CHI-CS-55DXX52', ip: '10.60.68.15', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_77' Driver info: driver.version: FirefoxDriver at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:80) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:597) ... 34 more 

I do see Firefox opening, but it just fails to create the session and the closes. 我确实看到Firefox打开,但是它无法创建会话并关闭。 I am currently running on this machine Firefox version 41.0 我目前正在这台机器上运行Firefox version 41.0

This is the incapability issue between Selenium3 and Mozilla Firefox version. 这是Selenium3Mozilla Firefox版本之间的功能无法解决的问题。

Actually Selenium3 supports executable geckodriver to launch Mozilla Firefox just like other driver now but executable geckodriver compatible with Mozilla Firefox >= v47 , that's why you're in trouble. 其实Selenium3支持可执行geckodriver推出Mozilla Firefox ,就像现在其他车手,但可执行geckodriver兼容Mozilla Firefox >= v47 ,这就是为什么你就麻烦了。

There are two work around to get rid from this issue :- 有两种方法可以解决此问题:-

  • Downgrade your selenium version to Selenium2 as well. 也将您的硒版本降级到Selenium2

  • Upgrade your Mozilla Firefox >= v47 as well and try with Selenium3 and launching FirefoxDriver as below :- 也升级您的Mozilla Firefox >= v47 ,并尝试使用Selenium3并启动FirefoxDriver ,如下所示:-

     //Set system property with downloaded executable geckodriver from your system location DesiredCapabilities cap = DesiredCapabilities.firefox(); cap.setCapability("marionette", true); WebDriver driver = new FirefoxDriver(cap); 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法使用 GeckoDriver 启动 Firefox - Cannot Launch Firefox using GeckoDriver 如何通过GeckoDriver和Selenium启动Firefox浏览器 - How to launch Firefox browser through GeckoDriver and Selenium 我正在尝试在 Ubuntu 22.04.1 LTS 中使用 Geckodriver 为 selenium webDriver 启动 Firefox 并得到错误消息 - I am trying to launch Firefox using geckodriver for selenium webDriver in Ubuntu 22.04.1 LTS and got error msg as - org.openqa.selenium.WebDriverException: java.net.ConnectException: 无法使用 GeckoDriver Firefox 和 Selenium 连接到 localhost/0:0:0:0:0:0:0 - org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0 using GeckoDriver Firefox and Selenium Firefox不是使用Geckodriver和Selenium推出的 - 它适用于Chrome - Firefox is not launched using Geckodriver and Selenium - It works with Chrome 如何使用 GeckoDriver Firefox 和 Selenium 下载文件? - How to download files using GeckoDriver Firefox and Selenium? 无法通过 Jenkins 中的 Selenium Maven 使用 GeckoDriver Firefox 建立与 WindowServer 错误的默认连接 - FAILED TO establish the default connection to the WindowServer error using GeckoDriver Firefox through Selenium Maven in Jenkins Selenium,Firefox和GeckoDriver - Selenium, Firefox and GeckoDriver 使用 selenium webdriver 版本 3.0.0.beta3 无法点击链接 - Unable to click the link using selenium webdriver Version 3.0.0.beta3 通过 Selenium 和 Java 使用 GeckoDriver 和 Firefox 无法点击链接 - Link is not clickable using GeckoDriver and Firefox through Selenium and Java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM