org.openqa.selenium.WebDriverException:等待驱动程序服务器开始在Linux计算机上开始使用Selenium Chromedriver和Chrome浏览器

时间:2019-08-26 16:39:13

标签: selenium google-chrome selenium-webdriver webdriver selenium-chromedriver

我正在尝试在Linux Build Agent(在Bamboo中)中运行一些Selenium自动化测试,当我从docker运行它们时,这些测试可以正常工作,但是当我在我的代理上直接安装Chrome和所需的必要工具时,运行它们,我得到以下错误。

Starting ChromeDriver 75.0.3770.140 (2d9f97485c7b07dc18a74666574f19176731995c-refs/branch-heads/3770@{#1155}) on port 9515
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
2019-08-26 13:16:30:08S +0100 [SEVERE] onError:Timed out waiting for driver server to start.
Build info: version: '3.5.3', revision: 'a88d25fe6b', time: '2017-08-29T12:42:44.417Z'
System info: host: 'xxxx', ip: '10.41.39.14', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-957.12.1.el7.x86_64', java.version: '1.8.0_191'
Driver info: driver.version: SeleniumDriver
org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '3.5.3', revision: 'a88d25fe6b', time: '2017-08-29T12:42:44.417Z'
System info: host: 'xxxx', ip: 'xxxx', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-957.12.1.el7.x86_64', java.version: '1.8.0_191'
Driver info: driver.version: SeleniumDriver
    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:78)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:646)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:255)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:237)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:138)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:178)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:146)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:xxxx/status] to be available after 20001 ms
    at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:102)
    at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:187)
    ... 18 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:77)
    ... 19 more

[DEBUG]   | Timed out waiting for driver server to start.
Build info: version: '3.5.3', revision: 'a88d25fe6b', time: '2017-08-29T12:42:44.417Z'
System info: host: 'xxxx', ip: 'xxxx', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-957.12.1.el7.x86_64', java.version: '1.8.0_191'
Driver info: driver.version: SeleniumDriver

我不知道这里出了什么问题,我的docker映像也与某些版本的Chromedrivers具有相同的操作系统。我在哪里错呢?

1 个答案:

答案 0 :(得分:0)

此错误消息...

2019-08-26 13:16:30:08S +0100 [SEVERE] onError:Timed out waiting for driver server to start.
Build info: version: '3.5.3', revision: 'a88d25fe6b', time: '2017-08-29T12:42:44.417Z'
System info: host: 'xxxx', ip: '10.41.39.14', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-957.12.1.el7.x86_64', java.version: '1.8.0_191'
Driver info: driver.version: SeleniumDriver

...表示 ChromeDriver 无法启动/产生新的 WebBrowser ,即 Chrome浏览器会话。

您的主要问题是所使用的二进制版本之间的不兼容性

  • 您正在使用 chromedriver = 75.0
  • chromedriver=75.0的发行说明中明确提到以下内容:
  

支持 Chrome 75版

  • 大概您正在使用 chrome = 76.0
  • ChromeDriver v76.0的发行说明中明确提到以下内容:
  

支持 Chrome 76版

  • 您的 Selenium Client 版本是 2017-08-29T12:42:44.417Z 3.5.3 2

因此 Selenium Client v3.5.1 ChromeDriver v75.0 Chrome浏览器v76.0 < / p>


解决方案

确保: