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
相关推荐
gwjcloud1 小时前
Docker详解
java·docker·容器
白毛大侠2 小时前
Docker vs 虚拟机 vs Go 用户态/内核态:这三组概念
运维·docker·golang·kvm
Jackyzhe3 小时前
从零学习Kafka:认证机制
分布式·学习·kafka
java修仙传4 小时前
从手写 Redis 锁到 Redisson:我对分布式锁安全性的理解
java·数据库·redis·分布式
Warren984 小时前
Windows本地部署n8n完整教程(基于Docker,新手友好)
运维·windows·python·测试工具·docker·容器·可用性测试
juniperhan7 小时前
Flink 系列第10篇:Flink 分布式缓存详解
分布式·缓存·flink
倦王7 小时前
在docker下部署Xinference
运维·docker·容器
阿火~7 小时前
docker完整镜像迁移【亲测有效】
linux·运维·服务器·docker·容器
两点王爷7 小时前
在离线的Ubuntu机器中安装docker
运维·docker·容器
Harvy_没救了8 小时前
Docker Desktop 部署新项目详细步骤
运维·docker·容器