Selenium chrome PHP webdriver(未知错误:DevToolsActivePort 文件不存在)

时间:2021-04-24 11:19:33

标签: selenium selenium-webdriver selenium-chromedriver

在 docker 中进行 selenium 测试,突然停止工作

在日志中显示

Fatal error: Uncaught Facebook\WebDriver\Exception\UnknownErrorException: unknown error: Chrome failed to start: crashed.
  (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.)

我登录容器并手动安装了 google-chrome-stable (90.0.4430.85-1) 和 chromium-chromedriver (90.0.4430.72-0ubuntu0.16.04. 1)

启动 Chrome 时出现错误

Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

然后我用 --no-sandbox 标志启动它,但现在它返回

[264:264:0424/105210.655665:ERROR:browser_main_loop.cc(1386)] Unable to open X display.
root@9a0073021ee5:/usr/bin# [0424/105210.664350:ERROR:nacl_helper_linux.cc(307)] NaCl helper process running without a sandbox!      

我尝试了所有可能的建议标志,例如 ["no-sandbox", "headless", "disable-gpu", "disable-dev-shm-usage"]

但它不起作用。

非常感谢任何帮助

1 个答案:

答案 0 :(得分:-1)

与 Docker 容器内的 Ubuntu 无关,问题与在 Windows 上运行的 Docker 桌面有关,它首先启动这些容器。相同的 Docker 设置但在 linux 机器上工作得很好。将根据此信息打开另一张票。

相关问题