java Selenium 3.7 webdriver 错误:等待驱动程序服务器启动超时

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/47241046/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 09:33:10  来源:igfitidea点击:

Selenium 3.7 webdriver Error: Timed out waiting for driver server to start

javaselenium-webdriverselenium-chromedriverselenium3

提问by Maggie

Upgraded to Selenium 3.7 recently and ran into error.

最近升级到 Selenium 3.7 并遇到错误。

Error trace log:

错误跟踪日志:

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

Debug 1 Debug 2 在端口 2198 上启动 ChromeDriver 2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2) 仅允许本地连接。线程“main”org.openqa.selenium.WebDriverException 中的异常:等待驱动程序服务器启动超时。构建信息:版本:'3.7.1',修订:'8a0099a',时间:'2017-11-06T21:07:36.161Z' 系统信息:主机:'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.version: ChromeDriver 在 org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:192) 在 org.openqa.selenium.remote.service.DriverService.start(DriverService.java:178) 在 org.openqa.selenium。偏僻的。http://localhost:2198/status]在 org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100) 在 org.openqa.selenium.remote.service.DriverService.waitUntilAvailable( DriverService.java:187) ... 9 导致: java.util.concurrent.FutureTask.get(FutureTask.java:205) 上的 java.util.concurrent.TimeoutException at com.google.common.util.concurrent.SimpleTimeLimiter .callWithTimeout(SimpleTimeLimiter.java:147) 在 org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75) ... 10 更多

Code:

代码:

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();
}

Included Libraries: selenium-server-standalone-3.7.1.jar

包含的库:selenium-server-standalone-3.7.1.jar

System Environment:

系统环境:

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 操作系统:“10.12.6”

java.version: '1.8.0_121'

selenium-server-standalone-3.7.1.jar

geckodriver - v0.19.1

ChromeDriver 2.33

Chrome 版本 62.0.3202.89(64 位)

Thank you for any thought.

谢谢你的任何想法。

回答by Radu Ciobanu

I had the same issue, on Mac OS. Check your /etc/hosts file and make sure you have 127.0.0.1 binding to localhost. I was missing that, added it and voila!

我在 Mac OS 上遇到了同样的问题。检查您的 /etc/hosts 文件并确保您有 127.0.0.1 绑定到本地主机。我错过了,添加它,瞧!

回答by Vijai

I faced same issue with ChromeDriver 74.0.3729.6, chrome browser 74 and selenium-java-3.141.59 Changed the selenium java libs to version selenium-java-3.13.0 it worked

我在 ChromeDriver 74.0.3729.6、chrome 浏览器 74 和 selenium-java-3.141.59 上遇到了同样的问题 将 selenium java 库更改为版本 selenium-java-3.13.0 它有效

回答by DebanjanB

As you are seeing WebDriverException: Timed out waiting for driver server to start.try the below mentioned steps :

正如您所看到的,请WebDriverException: Timed out waiting for driver server to start.尝试以下提到的步骤:

  • Uninstall Google Chrome through Revo Uninstaller.

  • Install the latest version of Google Chrome.

  • Perform some steps on the website so you are sure that the website opens properly.

  • If needed induce Explicit Waiti.e. WebDriverWait

  • 通过Revo Uninstaller.

  • 安装最新版本的Google Chrome.

  • 在网站上执行一些步骤,以确保网站正确打开。

  • 如果需要诱导Explicit WaitWebDriverWait

回答by Ram

Change this

改变这个

System.setProperty("webdriver.chrome.driver", "/Users/maggie/Documents/ToolsQA/Libs/chromedriver" to "/Users/maggie/Documents/ToolsQA/Libs/chromedriver.exe" and try this

System.setProperty("webdriver.chrome.driver", "/Users/maggie/Documents/ToolsQA/Libs/chromedriver" 到 "/Users/maggie/Documents/ToolsQA/Libs/chromedriver.exe" 并试试这个