最近升級到Selenium 3.7並出現錯誤。Selenium 3.7 webdriver錯誤:超時等待驅動程序服務器啓動
錯誤跟蹤日誌:
Debug 1 Debug 2 Starting ChromeDriver 2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2) on port 2198 Only local connections are allowed. Exception in thread "main" org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start. Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:07:36.161Z' System info: host: 'Maggies-MacBook-Pro-2.local', ip: '192.168.1.6', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_121' Driver info: driver.version: ChromeDriver at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:192) at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:178) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:181) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:168) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:123) at AutomationFrameWork.FirstTestCase.main(FirstTestCase.java:13) Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [ http://localhost:2198/status] to be available after 20005 ms at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100) at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:187) ... 9 more Caused by: java.util.concurrent.TimeoutException at java.util.concurrent.FutureTask.get(FutureTask.java:205) at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:147) at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75) ... 10 more
代碼:
public static void main (String args[]){
System.out.println("Debug 1");
System.setProperty("webdriver.chrome.driver", "/Users/maggie/Documents/ToolsQA/Libs/chromedriver");
System.out.println("Debug 2");
WebDriver driver = new ChromeDriver();
System.out.println("Debug 3");
driver.get("http://www.google.com");
driver.quit();
}
包括圖書館: 硒服務器獨立-3.7.1.jar
系統環境:
Mac OS: '10.12.6'
java.version: '1.8.0_121'
selenium-server-standalone-3.7.1.jar
geckodriver - v0.19.1
ChromeDriver 2.33
Chrome Version 62.0.3202.89 (64-bit)
謝謝你的任何想法。
在大多數情況下,您的特定**驅動程序版本**不適用於特定的**瀏覽器版本**。嘗試兩種版本,並閱讀開發者對支持的看法。對於不同的系統,如您的** Mac **,它也可能會變得更加複雜。例如,在我的** Raspberry Pi **上,我搜索了近2個小時的驅動程序 - 瀏覽器版本對。 – Zabuza