selenium - Selenium/hub 在 network_mode = "host" 时无法识别 selenium/node-chrome-debug
问题描述
我使用 Docker 在 network_mode = "host" 中启动我的 Selenium 网格,以便我可以访问我的本地开发站点。
集线器和节点都启动了,但是当我检查http://localhost:4444/grid/console时,没有节点。我想知道是否有任何方法可以解决它。
更多信息:
- 图像:集线器,节点铬调试
- Docker-Selenium 映像版本:3.14.0-arsenic
- Docker 版本:18.06.0-ce,构建 0ffa825
- 操作系统:Ubuntu 18.04
我的码头工人撰写文件:
version: "3"
services:
selenium-hub:
image: selenium/hub:latest
container_name: selenium-hub
network_mode: "host"
ports:
- "4444:4444"
chrome:
image: selenium/node-chrome-debug:latest
depends_on:
- selenium-hub
network_mode: "host"
ports:
- "5900:5900"
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=4444
解决方案
Diego Molina弄清楚了为什么它不起作用。
这是因为 Chrome 容器会尝试注册到 name selenium-hub
,该 name 不存在于“host”网络中,并且只会存在于 docker-compose 创建的网络中。
要使其正常工作,只需设置HUB_HOST=localhost
.
推荐阅读
- c# - 两个 ADO 模型,如何有条件地选择其中一个
- java - 如何使用 IntelliJ 中的相对路径从外部库中引用 jar 文件?
- javascript - 如何将播放暂停功能添加到网页的动态元素
- google-chrome-extension - 下载的 Chrome 扩展不能总是指定文件扩展名?
- opencv - OpenCV如何抓取实时帧而不是下一帧?
- mysql - 在 SQL 查询中查找组中较旧的记录
- netlogo - Netlogo - 如何确定一个乌龟强度转向?(标题)
- sql - 从运行总计 (SQL) 雪花中排除某些记录
- nginx - connect() failed (111: Connection refused) 尝试将代理从 nginx 传递到本地托管服务时出错
- installation - 为什么cupy安装过程检测不到Microsoft Visual C++?