Site Loader
Auckland, New Zealand
In this post we will discuss about Understanding and configuring Selenium Grid, I thought of making a simple post for selenium grid, but due to its vast concepts and techniques, I dig a little deeper to cover all the concepts required for one to get into the Selenium Grid concept understand fully rather just partially !!!

Selenium grid

SeleniumGrid allows you run your tests on different machines against different browsers in parallel. That is, running multiple tests at the same time against different machines running different browsers and operating systems. Essentially, SeleniumGrid support distributed test execution.

Distributed Architecture

We will try to understand how the selenium grid architecture looks like and a model is shown below

Selenium Grid basically has a setup of
  • Server (Also known as Hub)
  • Client (Also known as Node)

Selenium server as Hub

Selenium server can be turned in to a node or a hub and the simple command to do it is

java -jar selenium-server-standalone-2.46.0.jar –role

Selenium server as Node

To make selenium server act as node, we first need to have
  • Address of the hub(including port number)
  • Need to assign the role
So the command is

java -jar selenium-server-standalone-2.46.0.jar -role webdriver -hub http://10.101.16.225:4444/grid/register -port 5557

Desired capabilities

Desired Capabilities are used to set some properties for webdriver, since not all server implementation will every webdriver feature supports !! Couple of the desired capabilities we need to set in Selenium Grid setup for webdriver client code are
  • Platform
  • BrowserName
Here is the complete video for the above discussion. Please find below the code for above discussion
public class StarterofGrid {

    // RemotewebDriver instance
	public static RemoteWebDriver driver;

	public static void main(String[] args) throws MalformedURLException {


		DesiredCapabilities cap = null;
		cap = new DesiredCapabilities().firefox();
		cap.setBrowserName("firefox");

		cap.setPlatform(Platform.WIN8_1);

		driver = new RemoteWebDriver(new URL(remoteurl), cap);

		driver.navigate().to("http://www.google.com");

		
		driver.findElementByName("q").sendKeys("execute automation");

		driver.findElementByName("btnG").click();

	}

Thanks for reading the post and watching the video !!! Please leave your comments and let me know if there is anything I should update in this post. Thanks, Karthik KK

Post Author: Karthik kk

One Reply to “Selenium Grid understanding and configuring”

  1. Hi Karthik,
    Greatly impressed and gained much knowledge by all your videos! I’m an Automation QA, doing along BDD Specflow. I would like to run my tests using Selenium Grid in parallel. I did watched all your JAVA videos, still wondering is there any links or blogs executing Selenium Grid in C#.

    Thanks in advance!

Leave a Reply

Your email address will not be published. Required fields are marked *