Selenium Chromedriver server times out despite being available(Selenium Chromedriver 服务器超时,尽管可用)
问题描述
我有一个 Java Selenium 项目,它不能在我的机器上运行,但可以在具有相同操作系统版本 (OSX 10.13.1)、Chrome 浏览器版本 (63.0.3239.84) 和 chromedriver 版本 (2.34) 的同事机器上运行).我收到消息:
I have a Java Selenium project that will not run on my machine, but does run on coworkers' machines with the same OS version (OSX 10.13.1), Chrome browser version (63.0.3239.84), and chromedriver version (2.34). I get the message:
Starting ChromeDriver 2.34.522932 (4140ab217e1ca1bec0c4b4d1b148f3361eb3a03e) on port 18633
Only local connections are allowed.
org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
System info: host: 'localhost', ip: 'fe80:0:0:0:1cc9:e0ab:f4e5:dd34%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.1', java.version: '1.8.0_20'
Driver info: driver.version: ChromeDriver
...
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:18633/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)
... 28 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:149)
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)
... 29 more
但是,当我在浏览器中打开 http://localhost:18633/status 时,我得到了有效的响应:
however when I open http://localhost:18633/status in my browser I get a valid response:
{"sessionId":"","status":0,"value":{"build":{"version":"alpha"},"os":{"arch":"x86_64","name":"Mac OS X","version":"10.13.1"}}}
我试过换掉 chromedriver 二进制文件,但我不确定还能做什么.我在 geckodriver 上遇到了类似的问题,但这可能是也可能不是同一个问题.我还尝试在我的系统上创建一个新用户并从该帐户运行它,以考虑用户设置 - 不走运.
I've tried swapping out chromedriver binaries, but I'm not really sure what else to do. I get similar issues with geckodriver, but that may or may not be the same issue. I have also tried creating a new user on my system and running it from that account, to account for user settings - No luck.
我在这里缺少什么?哪些信息有助于调试此问题?
What am I missing here? What info would be helpful to debug this problem?
推荐答案
错误说明了一切:
org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
明确指出WebDriver 实例未启动.因此,Driver info 保留为 blank 为:
Clearly indicates the WebDriver instance didn't get initiated. Hence Driver info is left blank as :
Driver info: driver.version: ChromeDriver
哪个反过来产生错误:
org.openqa.selenium.net.UrlChecker$TimeoutException
和
java.util.concurrent.TimeoutException
<小时>
如果没有任何代码块的可见性,很难猜测实际原因,但通常我们可以通过下载 repository 并在初始化 WebDriver 实例时传递 ChromeDriver 的绝对路径,如下所示:
It would be tough to guess the actual reason without any visibility of your code block but in general we can solve this by downloading the ChromeDriver binary from this repository and passing the absolute path of the ChromeDriver while initializing the WebDriver instance as follows :
System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");
driver = new ChromeDriver();
<小时>
要点:
- 始终使用 Selenium Client 和 ChromeDriver 二进制文件的最新版本.
- 始终为浏览器启用自动更新.
- 始终保持 JDK 版本更新(当前版本为 JDK 8u241)
- Always use the latest version of the Selenium Client and ChromeDriver binaries.
- Always keep the automatic updates for the browser enabled.
- Always keep the JDK version updated (the current version being JDK 8u241)
Key Points :
这篇关于Selenium Chromedriver 服务器超时,尽管可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Selenium Chromedriver 服务器超时,尽管可用


- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01