TA的每日心情 | 郁闷 2017-12-13 10:06 |
---|
签到天数: 90 天 连续签到: 2 天 [LV.6]测试旅长
|
我的代码如下:
package cn.gloryroad;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;;
public class FirstWebDriverDemo {
public static void main(String[] args){
WebDriver driver;
String baseUrl;
System.setProperty
("webdriver.gecko.driver", "D:\\Tools\\geckodriver.exe");
/*
System.setProperty
("webdriver.firefox.bin", "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");
*/
driver = new FirefoxDriver();
baseUrl ="http://www.sogou.com/";
driver.get(baseUrl + "/");
driver.findElement(By.id("query")).sendKeys("光荣之路自动化测试");
driver.findElement(By.id("stb")).click();
}
}
error如下:
1498620765532 geckodriver INFO Listening on 127.0.0.1:21490
六月 28, 2017 11:32:45 上午 org.openqa.selenium.remote.ProtocolHandshake createSession
信息: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
1498620765864 geckodriver::marionette INFO Starting browser C:\Program Files (x86)\Mozilla Firefox\firefox.exe with args ["-marionette"]
1498620776579 Marionette INFO Listening on port 4899
六月 28, 2017 11:32:57 上午 org.openqa.selenium.remote.ProtocolHandshake createSession
信息: Falling back to original OSS JSON Wire Protocol.
六月 28, 2017 11:32:57 上午 org.openqa.selenium.remote.ProtocolHandshake createSession
信息: Falling back to straight W3C remote end connection
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions@5cb9f472, browserName=firefox, moz:firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions@5cb9f472, version=, platform=ANY}], required capabilities = Capabilities [{}]
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'SH-ESBU-DCL', ip: '172.28.19.83', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0'
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:238)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:127)
at cn.gloryroad.FirstWebDriverDemo.main(FirstWebDriverDemo.java:19)
|
|