最近我升级到了Selenium 3.7。
代码:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public static void main (String args[]){
System.setProperty("webdriver.gecko.driver",
"/usr/local/bin/geckodriver");
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
driver.quit();
}
包含的库:
selenium-java-3.7.1/selenium-server-standalone-3.7.1。罐子
selenium-java-3.7.1/libs/httpcore-4.4.6。罐子
selenium-java-3.7.1/libs/httpclient-4.5.3。罐子
selenium-java-3.7.1/libs/guava-23.0。罐子
selenium-java-3.7.1/libs/gson-2.8.2。罐子
selenium-java-3.7.1/libs/commons-logging-1.2。罐子
selenium-java-3.7.1/libs/commons-exec-1.3。罐子
selenium-java-3.7.1/libs/commons-codec-1.10。罐子
selenium-java-3.7.1/libs/byte-buddy-1.7.5。罐子
selenium-java-3.7.1/client-combined-3.7.1。罐子
selenium-java-3.7.1/client-combined-3.7.1-sources。罐子
系统环境:
Firefox 56.0.2
Java 1.8
selenium-java-3.7.1
selenium-server-standalone-3.7.1
错误跟踪日志:
用法:
/usr/local/bin/geckodriver[选项]/usr/local/bin/geckodriver:
未知选项--线程“main”中的端口=8970异常
组织。openqa。硒。WebDriverException:
组织。阿帕奇。http。conn.HttpHostConnectException:连接到
本地主机:8970[localhost/0:0:0:0:0:0:0:0:1,
localhost/fe80:0:0:0:0:0:0:1%1]失败:连接被拒绝(连接
拒绝)构建信息:版本:“3.7.1”,版本:“8a0099a”,时间:
“2017-11-06T21:07:36.161Z”系统信息:主机:
“Maggies-MacBook-Pro-2。本地”,ip:“192.168.1.6”,操作系统。名称:“Mac OS X”,
操作系统。拱门:“x86_64”,操作系统。版本:“10.12.6”,java。版本:“1.8.0_121”
驾驶员信息:驾驶员。版本:FirefoxDriver
如果您有任何想法,我们将不胜感激。非常感谢。
试用后更新德班詹建议:
代码:
public static void main (String args[]){
System.out.println("Debug 1");
System.setProperty("webdriver.gecko.driver",
"/Users/maggie/Documents/ToolsQA/Libs/geckodriver");
System.out.println("Debug 2");
WebDriver driver = new FirefoxDriver();
System.out.println("Debug 3");
driver.get("http://www.google.com");
driver.quit();
}
包括库:
selenium-server-standalone-3.7.1。罐子
系统环境:
Firefox 56.0.2
Java 1.8
selenium-java-3.7.1
geckodriver 0.19.1
Mac OS X’,操作系统。拱门:“x86_64”,操作系统。版本:“10.12.6”
错误跟踪日志:
调试1调试2启动ChromeDriver 2.33.506016
(8A06C39C4582FBFBBAB6966DBB1C38A9173BFB1A2)仅在端口2198上本地
组织。openqa。硒。WebDriverException:等待驱动程序超时
服务器启动。构建信息:版本:“3.7.1”,版本:“8a0099a”,
时间:2017-11-06T21:07:36.161Z系统信息:主机:
操作系统。拱门:“x86_64”,操作系统。版本:“10.12.6”,java。版本:“1.8.0_121”
驾驶员信息:驾驶员。版本:ChromeDriver at
组织。openqa。硒。遥远的服务驾驶员服务。WaitUntilavable(DriverService.java:192)
在
组织。openqa。硒。遥远的服务驾驶员服务。启动(DriverService.java:178)
在
组织。openqa。硒。遥远的服务驱动器命令执行器。执行(DriverCommandExecutor.java:79)
在
组织。openqa。硒。遥远的RemoteWebDriver。执行(RemoteWebDriver.java:600)
在
在
组织。openqa。硒。遥远的RemoteWebDriver。(RemoteWebDriver.java:142)
在
组织。openqa。硒。铬。ChromeDriver。(ChromeDriver.java:181)
在
组织。openqa。硒。铬。ChromeDriver。(ChromeDriver.java:168)
在
在AutomationFrameWork。第一个测试用例。main(FirstTestCase.java:13)
原因:组织。openqa。硒。网UrlChecker$TimeoutException:定时
外出等待[
http://localhost:2198/status]
之后可用
20005毫秒
在
组织。openqa。硒。遥远的服务驾驶员服务。WaitUntilavable(DriverService.java:187)
... 9更多原因:java。util。同时发生的时间异常
Java语言util。同时发生的未来任务。获取(FutureTask.java:205)
通用域名格式。谷歌。常见的util。同时发生的SimpleTimeLimiter。callWithTimeout(SimpleTimeLimiter.java:147)
在
... 10个以上