Site icon Vinsguru

Selenium WebDriver – Disposable Selenium Grid Infrastructure Setup using Zalenium

Overview:

We already have seen the challenges related to setting up the Selenium Grid infrastructure and how docker helps us in setting up a flexible/disposable/highly scalable selenium grid within few seconds in these articles below.

In this article, We will see how Zalenium (a similar dockerized selenium grid infrastructure with few other features) helps.

Udemy – Selenium WebDriver With Docker:

TestAutomationGuru has released a brand new course in Udemy on Selenium WebDriver with Docker. 14 hours course which starts with installing docker from scratch and goes all the way up to running dockerized selenium tests on AWS cloud. Please access the above link which gives you the special discount.  You can also get your money back if you do not like the course within 30 days.

Zalenium Setup:

docker run --rm -ti --name zalenium -p 4444:4444 -p 5555:5555 \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v /tmp/videos:/home/seluser/videos \
    dosel/zalenium start
DesiredCapabilities dc = DesiredCapabilities.firefox(); 
RemoteWebDriver driver=new RemoteWebDriver(new URL("http://10.11.12.13:4444/wd/hub"), dc);
 
driver.get("https://www.google.com");

Zalenium – Live Preview:

docker run --rm -ti --name zalenium -p 4444:4444 -p 5555:5555 \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v /tmp/videos:/home/seluser/videos \
    dosel/zalenium start --chromeContainers 3 --firefoxContainers 2

 

Demo:

I am running the test I had created as part of DatePicker Automation in this demo.

I have embedded this live preview in Jenkins itself. You would like to know how? Check here.

Dashboard:

desiredCapabilities.setCapability("name", "myTestName");
desiredCapabilities.setCapability("recordVideo", false);

Integrating with Cloud Testing Platforms:

Sauce Labs:

export SAUCE_USERNAME=[your Sauce Labs username]
export SAUCE_ACCESS_KEY=[your Sauce Labs access key]
docker run --rm -ti --name zalenium -p 4444:4444 -p 5555:5555 \
        -e SAUCE_USERNAME -e SAUCE_ACCESS_KEY \
        -v /tmp/videos:/home/seluser/videos \
        -v /var/run/docker.sock:/var/run/docker.sock \
        dosel/zalenium start --sauceLabsEnabled true

BrowserStack:

export BROWSER_STACK_USER=[your BrowserStack username]
export BROWSER_STACK_KEY=[your BrowserStack access key]
docker run --rm -ti --name zalenium -p 4444:4444 -p 5555:5555 \
        -e BROWSER_STACK_USER -e BROWSER_STACK_KEY \
        -v /tmp/videos:/home/seluser/videos \
        -v /var/run/docker.sock:/var/run/docker.sock \
        dosel/zalenium start --browserStackEnabled true

For more information on Zalenium, please check here.

 

Happy Testing & Subscribe 🙂

 

Share This:

Exit mobile version