我试着在jenkins的chrome上运行ui测试,从错误来看,它似乎无法启动。

org.openqa.selenium.WebDriverException: chrome not reachable
  (Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Linux 2.6.32-358.el6.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.54 seconds (user: 'UnknownUser-0', output: '1440016601647')
Build info: version: '2.45.0', revision: '5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27 09:10:26'
System info: host: 'abc.xyz.com', ip: '111.222.333.444', os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-358.el6.x86_64', java.version: '1.8.0_05'
Driver info: org.openqa.selenium.chrome.ChromeDriver
    at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:139)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:171)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:139)...

代码(在java中)只是尝试实例化chromedriver的默认实例,但失败了。日志中还显示了以下消息,这让我很困惑。司机好像在开,但马上就停了?
Starting ChromeDriver 2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf) on port 4601
Only local connections are allowed.
[0.422][WARNING]: PAC support disabled because there is no system implementation
Starting ChromeDriver 2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf) on port 9515
Only local connections are allowed.

实例化过程如下:
WebDriver webDriver = null;
String chromeDriverLocation = MyCustomPropertyReader.getProperty("webdriver.chrome.binary.location");
System.setProperty("webdriver.chrome.driver", chromeDriverLocation);
final DesiredCapabilities capabilities = DesiredCapabilities.chrome();
webDriver = new ChromeDriver(capabilities);

我能够从命令提示符运行chromedriver,并且我还检查了加载它所需的所有环境变量,以及在实例化期间确实可用的环境变量。
有人能告诉我我可能遗漏了什么,或者如果有办法获得关于失败原因的更多信息?

最佳答案

通过更新浏览器安装并确保chromedriver和chrome浏览器都可以从命令提示符运行,解决了该问题。

关于java - Chromedriver在Jenkins(Linux)上失败,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32106064/

10-15 14:05