selenium部署分布式 UI 自动化测试环境-Docker

一、根据selenium/hub官网的配置信息,进行配置。

复制代码
How to run this image
The Hub and Nodes will be created in the same network and they will recognize each other by their container name. A Docker network⁠ needs to be created as a first step.

Create a Docker Network
docker network create grid
Start the Hub using the created network
docker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub selenium/hub:latest
Start the Node using the created network
docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \
    --shm-size="2g" \
    -e SE_EVENT_BUS_PUBLISH_PORT=4442 \
    -e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
    selenium/node-chrome:latest
If you are using Windows Powershell, use this command:

docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub `
    --shm-size="2g" `
    -e SE_EVENT_BUS_PUBLISH_PORT=4442 `
    -e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 `
    selenium/node-chrome:latest
Point your WebDriver tests to http://localhost:4444⁠

在运行生成容器 selenium/node-chrome时,这里可以增加一些浏览器数量和关在数据卷目录的参数:

复制代码
-e SE_NODE_MAX_SESSIONS=2 
-e SE_NODE_OVERRIDE_MAX_SESSIONS=true
-v /Users/jd/selenium2node/dev/shm:/dev/shm
相关推荐
AlfredZhao44 分钟前
Docker 查看容器日志:别只记 `docker logs -f`
docker
初级炼丹师(爱说实话版)4 小时前
Ubuntu服务器配置docker
服务器·ubuntu·docker
生活爱好者!5 小时前
NAS还能用来开视频会议?docker一键部署MiroTalk SFU
运维·docker·容器
ACP广源盛139246256736 小时前
DeepSeek‑V4‑Flash 公测@ACP#昇腾 950 国产算力组合落地,国产 PCIe 交换芯片 IX9104 有哪些硬件机会
大数据·数据库·人工智能·分布式·单片机·嵌入式硬件·microsoft
兵bing7 小时前
Docker Compose 进阶配置与最佳实践笔记
docker
玉鸯7 小时前
多 Agent 并行时如何保证状态一致性?
分布式·python·agent
是良辰7 小时前
Docker Nginx HTTPS 自签证书部署完整操作文档
nginx·docker·https
CodeHackerBhx8 小时前
Spring Boot 4 防重复提交:从接口幂等到 Redis 分布式锁的完整实践
java·数据库·spring boot·redis·分布式
瞬间&永恒~8 小时前
【Docker】(四)Namespace 详解
运维·docker·容器
就改了8 小时前
Docker安装并运行Redis
redis·docker·容器