A small prototype running a Selenium Grid inside docker container to parallelize tests.
Selenium Grid is a way to run tests scenarios against a cluster of browser instances. Its based on a master slave architecture. First the hub (master) needs to be started. Then you can register as many browser instances (nodes) as needed.
The selenium community provides a set of standalone and grid Docker images. The
idea behind this prototype is to use docker-compose
to start a combination of
a Selenium hub instance and multiple browser nodes.
Convenience scripts are available inside the bin
folder.
./bin/run <number_of_nodes>
- Starts the hub and instances of Chrome and Firefox (default: 5)./bin/debug <number_of_nodes>
- Starts the hub and instances of debug Chrome and Firefox (default: 5)./bin/stop
- Stops the stack./bin/vnc <container_name>
- Starts the VNC viewer
For anything more complex use docker-compose
commands
It's possible to debug the browsers nodes using VNC.
First you need to determine the port use to connect to the VNC server by
running: docker port dockerselenium_chrome_<instance_number> 5900
Then using a VNC viewer you can connect to the node by using the URL
http://127.0.0.1:<port>
and the password secret
.
Once everything is launched you can access an overview of the nodes cluster at: http://localhost:4444/grid/console. For more informations on how to run tests on the cluster please take a look at the Selenium Grid documentation.