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
相关推荐
敲上瘾33 分钟前
Linux系统cgroups资源精细化控制基础
linux·测试工具·docker·压力测试·cgroups
伊成3 小时前
Docker 部署 Nginx 完整指南
nginx·docker·容器
落日漫游4 小时前
K8s核心组件全解析
运维·docker·运维开发
gc_22995 小时前
使用HtmlAgilityPack+PuppeteerSharp+iText7抓取Selenium帮助文档
selenium·itext7·htmlagilitypack·puppeteersharp
江湖有缘7 小时前
【Docker项目实战】使用Docker部署Notepad轻量级记事本
docker·容器·notepad++
yh云想7 小时前
《从入门到精通:Kafka核心原理全解析》
分布式·kafka
BTU_YC9 小时前
docker compose部署mysql
mysql·adb·docker
Python私教10 小时前
Docker in Test:用一次性的真实环境,终结“测试永远跑不通”魔咒
运维·docker·容器
ModelWhale12 小时前
“大模型”技术专栏 | 浅谈基于 Kubernetes 的 LLM 分布式推理框架架构:概览
分布式·kubernetes·大模型
愿天堂没有C++12 小时前
C++——分布式
分布式