Zalenium is a highly flexible and auto-scalable Docker container-based Selenium Grid Infrastructure. It has the feature to spin up selenium docker containers instantly as nodes without any manual intervention. It also has a video recording feature that can be viewed using a VNC player which is hosted within the live preview board.
The main objective of Zalenium is to have a disposable and flexible Selenium Grid Infrastructure for everyone and in an automated fashion.
Selenium Grid Challenges
- Maintaining a stable grid to run UI tests across browsers
- Maintaining it over time
- Costs more when it comes to the maintenance of many VM machines
- Provide features for all browsers and platforms
Thanks to Diego Molina for creating this wonderful solution, Zalenium provides docker-selenium nodes that are created on-demand and disposes of itself after test execution without giving any commands. With this, the test cases run very faster as the browsers are running in the local machine.
- Basic docker understanding
- Test Automation framework with Selenium-Grid implemented
- Docker v1.11.1 or above
In mac, open Terminal (In Windows, open Powershell)
First, pull selenium docker image –
docker pull elgalu/selenium
Then pull Zalenium docker image –
docker pull dosel/Zalenium
After the two images are pulled, use the below command to start the Selenium-Grid via Zalenium and 2 docker-selenium nodes will be instantiated –
docker run --rm -ti --name zalenium -p 4444:4444 \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /tmp/videos:/home/seluser/videos \ --privileged dosel/zalenium start
After running the above command and once the grid is started, launch below URL to view the grid console. You will be able to see two containers started by default –
To view the Dashboard, type the below command to launch the Zalenium Dashboard to view the test results and the recording video –
You can view LIVE execution via VNC viewer
We have now started the Zalenium with a HUB and two NODES successfully.
All we need to do now is, in the test automation framework, add the RemoteWebDriver URL as –
Example (Java) –
RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), desiredCapabillities);
When running the test suite, the real magic happens ✨ For each and every test, a unique docker container will be created and assigned, and the test gets executed. The beauty is, all tests will execute in parallel.
Step 8: View the Dashboard once the test execution gets completed. You will be able to view the video as well –
Benefits of using Zalenium
- Stable and scalable selenium grid infrastructure in no time.
- Everything happens within the local machine. Hence, there is no need for separate laptops or VMs.
- Tests can be executed with various viewports by defining width and height. With this, the mobile version can also be tested without any special efforts or tools.
- No special maintenance required for Hubs and Nodes.
- Reduces the test execution time up to 90%.
- Easy integration with third-party tools like BrowserStack & Sauce Labs.
- CI/CD ready.
- Automatic disposal of docker containers.
- Video recordings of tests in headless mode.
- No special network settings required except the proxy settings as the containers take it from Hub (host machine).
- Highly configurable with many capabilities (check the Configuration Parameters in Zalenium Website).