ExecuteAutomation

Selenium Grid understanding and configuring

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

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 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 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