Skip to main content

How To Create Selenium Grid

Selenium Grid allows you to run many testcases simultaneously.
There are many ways to create Selenium Grid easily.
You can also use third party services like SauceLabs etc to execute your testcases.
I haven't use third party service for running my test cases.
If you don't want to use third party service then you can create Selenium Grid in following ways.

Selenium-server-standalone jar

For my local testing i prefer to use selenium server standalone jar to create selenium gird.
It is very easy and quick way to create Selenium grid for quick testing.
You can download selenium server standalone jar from http://www.seleniumhq.org/download/
After downloading of jar execute following command
java -jar selenium-server-standalone-2.53.1.jar –role hub

This Selenium Grid will have one node which will execute your testcases. With default settings single node can run 5 chrome instances simultaneously.
Go to  and verify Selenium Grid configurations.

Docker

If you have docker installed on your machine then you can quickly create selenium node with as many node as possible. You can scale your Selenium Grid easily.
Create docker-compose.yml
selhub:
  image: selenium/hub
  ports:
    - 4444:4444

nodeff:
  image: selenium/node-firefox-debug
  ports:
    - 5900
  links:
    - selhub:hub

nodechrome:
  image: selenium/node-chrome-debug
  ports:
    - 5900
  links:
    - selhub:hub

Create Selenium Grid by executing following command
docker-compose up -d
Major advantage in using docker to create selenium grid is you can easily increase and decrease capacity of Selenium Grid. To have 10 chrome node in selenium grid
docker-compose scale  nodechrome=10

Selenium Grid Extras

You can also use Selenium Grid Extras to create/manage Selenium Grid.
I haven't used it but it looks very good.

Comments