Selenium Chrome浏览器org.openqa.selenium.WebDriverException:等待驱动程序服务器启动时超时 [英] Selenium Chrome Browser org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start

查看:328
本文介绍了Selenium Chrome浏览器org.openqa.selenium.WebDriverException:等待驱动程序服务器启动时超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public class Dem {
    public static void main(String[] args) throws InterruptedException {
    WebDriver driver;
    String url = "https://www.google.com";
    System.setProperty("webdriver.chrome.driver","C:\\Users\\Jim\\Downloads\\chromedriver_win32\\chromedriver.exe");
    driver = new ChromeDriver();
    driver.get(url);
    driver.close();
    }
}

Selenium Webdriver和Chrome驱动程序是 最新版本

Selenium webdriver and Chrome driver are the latest versions

Selenium webdriver:3.14.0

Selenium webdriver :3.14.0

chromedriver:2.42

chromedriver: 2.42

java:1.8.0_181

java:1.8.0_181

这是运行代码后的错误. Google chrome根本不会启动.

严重:org.apache.commons.exec.ExecuteException:进程退出,错误为:-1073741792(退出值:-1073741792)中的异常 线程主要" org.openqa.selenium.WebDriverException:超时 等待驱动程序服务器启动.构建信息:版本:"3.14.0", 修订:'aacccce0',时间:'2018-08-02T20:13:22.693Z'驱动程序信息: driver.version:位于的ChromeDriver org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:193) 在 org.openqa.selenium.remote.service.DriverService.start(DriverService.java:179) 在 org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79) 在 org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548) 在 org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212) 在 org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:130) 在 org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:181) 在 org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:168) 在 org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:123) at news.Dem.main(Dem.java:17)由以下原因引起: org.openqa.selenium.net.UrlChecker $ TimeoutException:等待超时 为[ http://localhost:32986/status 在20002毫秒后可用 org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100) 在 org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:188) ...还有9个

SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: -1073741792 (Exit value: -1073741792) Exception in thread "main" org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start. Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z' Driver info: driver.version: ChromeDriver at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:193) at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:179) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:130) 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 news.Dem.main(Dem.java:17) Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:32986/status] to be available after 20002 ms at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100) at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:188) ... 9 more

推荐答案

调试步骤

可能是以下两个问题之一.

Debugging Steps

It may be either of the two below issue.

1. Chrome驱动程序由于某种原因无法启动:

手动在终端中运行chrome驱动程序

Run the chrome driver in terminal maually

C:\ Users \ Jim> C:\Users\Jim\Downloads\chromedriver_win32\chromedriver.exe

现在,我们必须获得以下消息,指示服务器已成功启动.

Now we have to get the following message denoting server started sucessfully.

如果未收到上述消息且服务器未启动,请检查出什么错误并正确响应?可能下载了损坏的二进制文件,请重新下载.

If you are not getting above message and your server is not started, then check what is error you are getting and respond accorsingly? May downloaded corrupted binary, the download it again.

2.无法访问主机名为localhost

2. Unable to access the chrome driver with hostname as localhost

如果您能够按照上述步骤成功启动chromedriver,现在尝试使用相应的端口访问以下网址. http://localhost:{port}/status

If you able to start chromedriver sucessfully as in above steps, now try to access the below url with respective port. http://localhost:{port}/status

例如,在上述消息中,服务器在端口9515上启动.在浏览器http://localhost:9515/status

For e.g., in above message, the server started on port 9515. Access the url in browser, http://localhost:9515/status

您应该获得以上消息,指示服务器可以使用主机名localhost

You should get above message indicating server is accessible with hostname as localhost

如果您无法访问,请使用管理员权限在编辑器中打开C:\ Windows \ System32 \ drivers \ etc \ hosts并检查localhost DNS是否已映射到127.0.0.1

If your are not able access, then open C:\Windows\System32\drivers\etc\hosts in editor with administrator privilege and check localhost DNS is mapped to 127.0.0.1

这篇关于Selenium Chrome浏览器org.openqa.selenium.WebDriverException:等待驱动程序服务器启动时超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆