git location: [ Ссылка ]
Selenium Grid 4 with Docker
Components/Architecture: Refer to the above video for details.
Roles:
Standalone-Combines all Grid components seamlessly into one.
Hub and Node-Hub on 1 machine with all components & Separate nodes
Distributed- All components on different machines.
[ Ссылка ]
Choosing a grid role-
Requirements : No of test cases, time taken
Infra support:Creating sessions concurrently relies on the available processors to the Distributor. For example, if a machine has 4 CPUs, the Distributor will only be able to create up to 4 sessions concurrently.
By default, the maximum amount of concurrent sessions a Node supports is limited by the number of CPUs available. For example, if the Node machine has 8CPUs, it can run up to 8 concurrent browser sessions (with the exception of Safari, which is always one). Additionally, it is expected that each browser session should use around 1GB RAM.
In general, it is a recommended to have Nodes as small as possible. Instead of having a machine with 32CPUs and 32GB RAM to run 32 concurrent browser sessions, it is better to have 32 small Nodes in order to better isolate processes. With this, if a Node fails, it will do it in an isolated way. Docker is a good tool to achieve this approach.
- 5 or less Nodes- Standalone/hub-node
- 6 to 100 node - hub/node
- 100 above node -distributed
Quick Demo-
- Start a Docker container with Firefox
docker run -d -p 4444:4444 -p 7900:7900 --shm-size="2g" selenium/standalone-firefox:4.10.0-20230607
- Point your WebDriver tests to [ Ссылка ]
- To see what is happening inside the container, head to [ Ссылка ].
Ещё видео!