在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:SeleniumHQ/docker-selenium开源软件地址:https://github.com/SeleniumHQ/docker-selenium开源编程语言:Shell 37.8%开源软件介绍:Docker images for the Selenium Grid ServerThe 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 Apache License 2.0. These Docker images come with a handful of tags to simplify its usage, have a look at them in one of our releases. To get notifications of new releases, add yourself as a "Releases only" watcher. These images are published to the Docker Hub registry at Selenium Docker Hub. CommunityDo you need help to use these Docker images? Talk to us at https://www.selenium.dev/support/ Contents
Quick start
docker run -d -p 4444:4444 -p 7900:7900 --shm-size="2g" selenium/standalone-firefox:4.2.1-20220531
More details about visualising the container activity, check the Debugging section.
Experimental Mult-Arch aarch64/armhf/amd64 ImagesFor experimental docker container images, which run on platforms such as the Mac M1 or Raspberry Pi, see the community driven repository hosted at seleniumhq-community/docker-seleniarm. These images are built for three separate architectures: linux/arm64 (aarch64), linux/arm/v7 (armhf), and linux/amd64. Furthermore, these experimental container images are published on Seleniarm Docker Hub registry. See issue #1076 for more information on these images. If you're working on an Intel or AMD64 architecture, we recommend using the container images in this repository (SeleniumHQ/docker-selenium) instead of the experimental ones. Execution modesStandalonedocker run -d -p 4444:4444 --shm-size="2g" selenium/standalone-firefox:4.2.1-20220531 docker run -d -p 4444:4444 --shm-size="2g" selenium/standalone-chrome:4.2.1-20220531 docker run -d -p 4444:4444 --shm-size="2g" selenium/standalone-edge:4.2.1-20220531 Note: Only one Standalone container can run on port Hub and NodesThere are different ways to run the images and create a Grid with a Hub and Nodes, check the following options. Docker networkingThe 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. macOS/Linux$ docker network create grid
$ docker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub selenium/hub:4.2.1-20220531
$ 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:4.2.1-20220531
$ 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-edge:4.2.1-20220531
$ 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-firefox:4.2.1-20220531 Windows PowerShell$ docker network create grid
$ docker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub selenium/hub:4.2.1-20220531
$ 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:4.2.1-20220531
$ 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-edge:4.2.1-20220531
$ 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-firefox:4.2.1-20220531 When you are done using the Grid, and the containers have exited, the network can be removed with the following command: # Removes the grid network
$ docker network rm grid Using different machines/VMsThe Hub and Nodes will be created on different machines/VMs, they need to know each other's IPs to communicate properly. If more than one node will be running on the same Machine/VM, they must be configured to expose different ports. Hub - Machine/VM 1$ docker run -d -p 4442-4444:4442-4444 --name selenium-hub selenium/hub:4.2.1-20220531 Node Chrome - Machine/VM 2macOS/Linux$ docker run -d -p 5555:5555 \
--shm-size="2g" \
-e SE_EVENT_BUS_HOST=<ip-from-machine-1> \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
-e SE_NODE_HOST=<ip-from-machine-2> \
selenium/node-chrome:4.2.1-20220531 Windows PowerShell$ docker run -d -p 5555:5555 `
--shm-size="2g" `
-e SE_EVENT_BUS_HOST=<ip-from-machine-1> `
-e SE_EVENT_BUS_PUBLISH_PORT=4442 `
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 `
-e SE_NODE_HOST=<ip-from-machine-2> `
selenium/node-chrome:4.2.1-20220531 Node Edge - Machine/VM 3macOS/Linux$ docker run -d -p 5555:5555 \
--shm-size="2g" \
-e SE_EVENT_BUS_HOST=<ip-from-machine-1> \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
-e SE_NODE_HOST=<ip-from-machine-3> \
selenium/node-edge:4.2.1-20220531 Windows PowerShell$ docker run -d -p 5555:5555 `
--shm-size="2g" `
-e SE_EVENT_BUS_HOST=<ip-from-machine-1> `
-e SE_EVENT_BUS_PUBLISH_PORT=4442 `
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 `
-e SE_NODE_HOST=<ip-from-machine-3> `
selenium/node-edge:4.2.1-20220531 Node Firefox - Machine/VM 4macOS/Linux$ docker run -d -p 5555:5555 \
--shm-size="2g" \
-e SE_EVENT_BUS_HOST=<ip-from-machine-1> \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
-e SE_NODE_HOST=<ip-from-machine-4> \
selenium/node-firefox:4.2.1-20220531 Windows PowerShell$ docker run -d -p 5555:5555 `
--shm-size="2g" `
-e SE_EVENT_BUS_HOST=<ip-from-machine-1> `
-e SE_EVENT_BUS_PUBLISH_PORT=4442 `
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 `
-e SE_NODE_HOST=<ip-from-machine-4> `
selenium/node-firefox:4.2.1-20220531 Node Chrome - Machine/VM 4macOS/Linux$ docker run -d -p 5556:5556 \
--shm-size="2g" \
-e SE_EVENT_BUS_HOST=<ip-from-machine-1> \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
-e SE_NODE_HOST=<ip-from-machine-4> \
-e SE_NODE_PORT=5556 \
selenium/node-chrome:4.2.1-20220531 Windows PowerShell$ docker run -d -p 5556:5556 `
--shm-size="2g" `
-e SE_EVENT_BUS_HOST=<ip-from-machine-1> `
-e SE_EVENT_BUS_PUBLISH_PORT=4442 `
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 `
-e SE_NODE_HOST=<ip-from-machine-4> `
-e SE_NODE_PORT=5556 `
selenium/node-chrome:4.2.1-20220531 Docker ComposeDocker Compose is the simplest way to start a Grid. Use the linked resources below, save them locally, and check the execution instructions on top of each file. Version 2Version 3To stop the Grid and cleanup the created containers, run Version 3 with Swarm supportFully distributed mode - Router, Queue, Distributor, EventBus, SessionMap and NodesIt is possible to start a Selenium Grid with all its components apart. For simplicity, only an example with docker-compose will be provided. Save the file locally, and check the execution instructions on top of it.
Video recordingTests execution can be recorded by using the Currently, the only way to do this mapping is manually (either starting the containers manually, or through
The video Docker image we provide is based on the ffmpeg Ubuntu image provided by the
jrottenberg/ffmpeg project, thank you for providing this image and
simplifying our work |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论