Managing Selenium Node using Zalenium


Previously, we discussed ways to manage Selenium Grid and nodes manually and using servlets. While both solutions can be quickly implemented, they should not be considered as scalable and long term solutions. Zalenium is a new tool which leverages Docker to quickly provision nodes and allow video inspections as bonus. It does not involve big learning curve (although you do need to know Docker) and can be used out of the box for most situation.


How could a tester manage Selenium Node using Zalenium?


Zalenium’s setup is fairly simple. First of all ensure you have installed Docker. Zalenium and its dependencies are using Docker images so some pulling will be required.

  1. Run this docker command to pull docker/selenium image. This image enable Firefox and Chrome browsers for zalenium.
    docker pull elgalu/selenium
  2. Run this docker command to pull zalenium image.
    docker pull dosel/zalenium
  3. Run this docker command to start zalenium image. This command also save recorded videos to your local drive (modify ‘/tmp/videos’ accordingly).
    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 zalenium is successfully started, go to http://localhost:4444/grid/console to see the Grid console. Zalenium provision additional nodes on demand, ie additional node is only provisioned when it received a desired platform/browser request.

Using the above settings, zalenium is able to provision Firefox and Chrome browsers. For further scalability, Zalenium allows provisioning of nodes in cloud providers such as SauceLabs and BrowserStack providing you have respective account. This allows testing in more diverse combination of platform and browser. More information on this integration can be found here.

Another advantage of Zalenium is it provides ability to preview currently running tests and ability to record test run. The preview can be accessed in http://localhost:4444/grid/admin/live and the recorded videos can be accessed in http://localhost:4444/dashboard.


Zalenium is the most practical solution to manage and scale Selenium Grid in effective manner. The setup is relatively simple and can be used out of the box. More information on zalenium can be seen here.


Managing Selenium Node using Servlet


We would more often than not require the ability to manage Selenium node from a remote location. There are few ways to do this, from out of the box solution to using open-source, scalable management tool. In this post, we will see example of managing Selenium Node using servlet.


How could a tester manage Selenium node using servlet?


Starting from version 2, Grid server capability can be extended using a custom servlet. The servlet accepts requests and performs requested action on the server side. Selenium Grid comes with a built-in servlet called Lifecycle servlet. This can be activated in node configuration:

-jar selenium-server-standalone.jar 
-role node 
-nodeConfig node.json
-servlet org.openqa.grid.web.servlet.LifecycleServlet

We can request an action to this servlet once the node is registered. Unfortunately, Lifecycle servlet is limited to shutdown function only. We can do this by requesting correct node’s URL:


Note that a servlet is not limited to start/stop function, but also for scaling and for other additional functions. There are other open source servlets which implement these additional functions (see example below), or you can create your own!

Examples of custom servlets:


Custom servlet can manage a Selenium node. This solution is relatively fast, however fairly limited and may require customization. In the next series of posts, we will look into alternative solutions to manage Selenium Node.