paint-brush
Getting Started with Zalenium: Docker-based Selenuim Gridby@testingfreak
800 reads
800 reads

Getting Started with Zalenium: Docker-based Selenuim Grid

by August 13th, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Zalenium is a container-based Selenium Grid featuring video recording, live preview, rudimentary authentication, and a dashboard. Integral integration of Docker and Kubernetes makes it appealing choice for setting up Selenium-based infrastructure. The integration of docker makes it a great choice to manage the selenium Grid. You can also redirect your tests to cloud grids like Sauce Labs, BrowserStack, TestingBot, CrossBrowser Testing, LambdaTest, and Lambda testnetes.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Getting Started with Zalenium: Docker-based Selenuim Grid
undefined HackerNoon profile picture

Zalenium is a container-based Selenium Grid featuring video recording, live preview, rudimentary authentication, and a dashboard. The integration of Docker and Kubernetes makes Zalenium an appealing choice for setting up Selenium-based infrastructure.

Why Zalenium is a great choice to manage the selenium Grid?

Selenium Grid consists of "Hub" and "Nodes". Nodes are the configurations that we want to test, such as Windows 10 with Chrome. We use RemoteWebDriver to point our tests to the HUB, which then routes them to the appropriate Node if one is available or queues them.

It's always difficult to set up a selenium grid with nodes since you need to know how many nodes to set up.  If there are too few nodes, your tests will begin to time out, and you will need to add more nodes. A large number of nodes causes a waste of machine resources.  Another challenge is to maintain nodes and keep up with the latest browser versions.

How does it sound to have a scalable and dynamic grid that adds nodes as needed and disposes them after the test is finished?

Introducing Zalenium - Selenium Grid extension which scales your local grid dynamically with docker containers to run tests in Firefox or Chrome. You can also redirect your tests to cloud grids like Sauce Labs, BrowserStack, TestingBot, CrossBrowser Testing, LambdaTest.

Let's try Zalenium:

1. Install Dockerdesktop on your system (if not already have yet)

https://docs.docker.com/docker-for-windows/install/

2. Check docker installation using the command: docker -v

3. Pull below docker images by using these commands:

docker pull elgalu/seleniumdocker pull dosel/zalenium

4. Check the docker image by using the command: docker images

5. Run Zalenium by below command on cmd:

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

6. After successfully running the previous commands, check if containers are up: docker ps

7. Now you can access below URL’s

Grid console – http://localhost:4444/grid/console
Zalenium Live Preview – http://localhost:4444/grid/admin/live
Dashboard – http://localhost:4444/dashboard/ after
running your first test

8. Run the selenium script by modifying the code as below:

9. You can watch the application running live by Zalenium live Preview:

10. After execution you can view the video of the test from the Zalenium Dashboard:


Find out more under complete documentation: 

https://opensource.zalando.com/zalenium/

Also published here by Tahera Firdose.