java.lang.RuntimeException:org.openqa.selenium.WebDriverException:未知错误:Chrome无法启动:异常退出

时间:2019-05-03 09:01:47

标签: java google-chrome selenium-chromedriver centos7 google-chrome-headless

我试图在centos7上使用chromedriver渲染网页。我同时安装了google-chromechromedriver。我正在使用以下命令启动chromedriver。

$ chromedriver --port=9515 --headless --whitelisted-ips="myip" --disable-dev-shm-usage --log-path='chrome.log'
Starting ChromeDriver 74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}) on port 9515
Remote connections are allowed by a whitelist (myip).
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.

我正在使用以下命令运行谷歌浏览器

$ google-chrome --headless --remote-debugging-port=9222 --disable-gpu
xcb_connection_has_error() returned true

DevTools listening on ws://127.0.0.1:9222/devtools/browser/cf6b15dd-0e37-4106-88ed-01b959252da4

我们在这里运行google-chromechromedriver。但是,当我的Java应用程序尝试连接到chromedriver运行的端口时,出现以下错误

java.lang.RuntimeException: org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Linux 3.10.0-862.3.2.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)

我在Windows环境中尝试了同样的方法,效果很好。

version:
ChromeDriver 74.0.3729.6
Google Chrome 74.0.3729.131

0 个答案:

没有答案