java – Selenium 3.0 Firefx驱动程序失败与org.openqa.selenium.SessionNotCreatedException无法创建新的远程会话

前端之家收集整理的这篇文章主要介绍了java – Selenium 3.0 Firefx驱动程序失败与org.openqa.selenium.SessionNotCreatedException无法创建新的远程会话前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
Selenium 3.0 Firefx驱动程序通过org.openqa.selenium.SessionNotCreatedException失败:无法创建新的远程会话.
System.setProperty("webdriver.gecko.driver","..<Path>../geckodriver.exe");
capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette",true);
driver = new FirefoxDriver(capabilities);


Caused by: org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true,firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions@23aa363a,browserName=firefox,moz:firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions@23aa363a,version=,platform=ANY}],required capabilities = Capabilities [{}]
Build info: version: '3.0.0',revision: '350cf60',time: '2016-10-13 10:48:57 -0700'
System info: host: 'D202540',ip: '10.22.19.193',os.name: 'Windows 7',os.arch: 'amd64',os.version: '6.1',java.version: '1.8.0_45'
Driver info: driver.version: FirefoxDriver
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:91)
    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:601)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:259)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:247)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:242)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:135)

解决方法

你需要下载geckodriver.然后设置
System.setProperty("webdriver.gecko.driver","path\\to\\geckodriver.exe")

检查这个link.

原文链接:https://www.f2er.com/java/123782.html

猜你在找的Java相关文章