The Hub and Nodes will be created in the same network and they will recognize each other by their container name. A Docker https://docs.docker.com/engine/reference/commandline/network_create/ needs to be created as a first step.
bashdocker network create grid
bashdocker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub selenium/hub:latest
bashdocker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \ --shm-size="2g" \ selenium/node-chrome:latest
If you are using Windows Powershell, use this command:
powershelldocker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub ` --shm-size="2g" ` selenium/node-chrome:latest
Point your WebDriver tests to http://localhost:4444
That's it!
(Optional) To see what is happening inside the container, head to http://localhost:7900/?autoconnect=1&resize=scale&password=secret.
When executing docker run for an image that contains a browser please use the flag --shm-size=2g to use the host's shared memory.
The example above uses latest as a tag, but we recommend to full tag to pin a specific browser and Grid version. Please see https://github.com/SeleniumHQ/docker-selenium/wiki/Tagging-Convention for details.
A more detailed explanation that shows how to run the Nodes in different configurations can be seen at the https://github.com/SeleniumHQ/docker-selenium/blob/trunk/README.md#hub-and-nodes
When you are done using the Grid, and the containers have exited, the network can be removed with the following command:
bashdocker network rm grid
The tag structure is as follows:
selenium/node-chrome-<Major>.<Minor>.<Patch>-<YYYYMMDD>
Also with browser version and browser driver version
selenium/node-chrome-<browserVersion>-<browserDriver>-<browserDriverVersion>-<Major>.<Minor>.<Patch>-<YYYYMMDD>
Plus all the permutations from the above one
Chrome 155.0 ChromeDriver 155.0 Selenium Server 4.51.0 Release date 20261010 e126989f151e selenium/node-chrome 4 e126989f151e selenium/node-chrome 4.51 e126989f151e selenium/node-chrome 4.51.0 e126989f151e selenium/node-chrome 4.51.0-20261010 e126989f151e selenium/node-chrome 155.0 e126989f151e selenium/node-chrome 155.0-20261010 e126989f151e selenium/node-chrome 155.0-chromedriver-155.0 e126989f151e selenium/node-chrome 155.0-chromedriver-155.0-20261010 e126989f151e selenium/node-chrome 155.0-chromedriver-155.0-grid-4.51.0-20261010
With that, you can use any of the different tags to get the most recent release in a simplified way.
The Docker-Selenium project in GitHub has an extensive https://github.com/SeleniumHQ/docker-selenium that will help you find the correct way to get this images up and running for your use case.
The project is made possible by volunteer contributors who have put in thousands of hours of their own time, and made the source code freely available under the https://raw.githubusercontent.com/SeleniumHQ/selenium/trunk/LICENSE.
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务
以下是 selenium/node-chrome 相关的常用 Docker 镜像,适用于 不同场景 等不同场景: