Run Selenium Tests on Google Cloud : using Docker, Kubernetes, Zalenium

Jayakrishnan Kunnath
3 min readAug 17, 2021

Hey Alien’s, In this blog let’s see how to run selenium tests in GCP cloud environment using Kubernetes.

What is Docker and Kubernetes

Kubernetes is an open-source container-orchestration system for automating computer application deployment, scaling, and management.

Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers.

Kubernetes

Set-up Kubernetes in GCP

  1. Create a Kubernetes cluster

Kubernetes Engine -> Clusters-> Create

Create Kubernetes cluster

2. Connect to the cluster using “Cloud Shell” : execute below commands

  • kubectl create namespace zalenium
  • kubectl get namespace
  • helm repo add zalenium-github https://raw.githubusercontent.com/zalando/zalenium/master/charts/zalenium
  • helm search repo zalenium
  • helm install my-release — namespace zalenium zalenium-github/zalenium — set hub.serviceType=”LoadBalancer”
    — set hub.basicAuth.enabled=”true” — set hub.basicAuth.username=”USERNAME” — set hub.basicAuth.password=”PASSWORD”
    kubectl get service my-release-zalenium — namespace=”zalenium”

3. Access Zalenium

Now all set,we can access the Zalenium Grid and dashboard portal using following URLS.

  • Zalenium Hub : http://External IP_Cluster/wd/hub/
  • Video : http://External IP_Cluster/grid/admin/live
  • Dashboard : http://External IP_Cluster/dashboard/#

3. Dive into code

Time to Rock N Roll!!!

Zalenium grid is ready now we can access same using code, Here is an example with Java.

4. Result :

Video of execution

So That’s all i have in this, Kubernetes will take care of auto scaling and down of the zalenium container as per the request it receives.

Thank you for checking this out!! Please comment if you get any queries.

Please share and subscribe!!

--

--