selenium - Selenium chrome PHP webdriver(未知错误:DevToolsActivePort 文件不存在)
问题描述
在 docker 中进行硒测试,突然停止工作
在日志中它显示
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"]
但它不起作用。
任何帮助是极大的赞赏
解决方案
与 Docker 容器内的 Ubuntu 无关,问题与在 Windows 上运行的 Docker 桌面有关,它首先启动这些容器。相同的 Docker 设置,但在 linux 机器上工作得很好。将根据此信息打开另一张票。
推荐阅读
- java - 如何修复 Micronaut Maven 构建失败
- r - R 范围距离 - 是否存在现有功能?
- python - python多处理中守护进程的目的是什么?
- angular - Angular 和纱线工作区:TS 编译时缺少文件
- opencv - 如何在同一图像上找到两点的长度
- javascript - 如何将相同的值分配给一行中的两个变量
- ldap - 多个地点和部门的 LDAP 过滤器查询
- typescript - 该函数应返回一个对象,该对象具有 key 作为参数 someKey 和 value 作为 someValue
- python - 如何在python中堆叠2个不同长度的numpy数组
- html - 如何制作(最)基本的 .htaccess 文件来密码保护网站