Display results as :

Rechercher Advanced Search

Latest topics

GRID setup tutorial.

View previous topic View next topic Go down

GRID setup tutorial.

Post by Adviser on Tue Mar 15, 2016 2:51 pm

Hi Guys,

I have done selenium grid setup on 5 different node which contains 2 LINUX and 3 Windows node. I would like to share the setup information to reduce the R&D time on that, which is totally frustrating Sad. But not any more, It's just a simple example of working setup and feel free to modify as per your requirement.


  1. download selenium standalone server on hub machine and setup Java also on all machines.
  2. download all the browser drivers which you want to supported on node and placed in a common directory.
  3. All machine should be on same network group otherwise you will have to do some effort to resolve the network and firewall issues.

Hub setup:
java -jar selenium-server-standalone-2.52.0.jar -role hub -port 4441

Node's setup:
java -jar selenium-server-standalone-2.52.0.jar -role webdriver -browser browserName=chrome -browser browserName=firefox -browser browserName="internet explorer" -hub [You must be registered and logged in to see this link.] -port 5566\Users\Advisor\Downloads\Selenium_browser_Driver\IEDriverServer_x64_2.52.2\IEDriverServer.exe\Users\Advisor\Downloads\Selenium_browser_Driver\chromedriver_win32\chromedriver.exe

Make sure all nodes are successfully registered and communicate properly with hub. Now, setup your IDE for working with web driver. google it if you don't know , how to setup.

This is the java code for running your test using grid. But right now it will execute on a single node at a time. If want to execute it on all setup node at the same time. You will have to use TestNG framework parallel method to execute simultaneously.


import net.sourceforge.htmlunit.corejs.javascript.ast.SwitchCase;

import org.openqa.selenium.By;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import  org.openqa.selenium.remote.DesiredCapabilities;

import java.util.Arrays;

import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;


 * @author adviser
 * grid command for node
 * java -jar selenium-server-standalone-2.52.0.jar -role webdriver -browser browserName=chrome -browser browserName=firefox -browser browserName="internet explorer" -hub -port 5566\Users\Advisor\Downloads\Selenium_browser_Driver\IEDriverServer_x64_2.52.2\IEDriverServer.exe\Users\Advisor\Downloads\Selenium_browser_Driver\chromedriver_win32\chromedriver.exe

public class GridDriver {
 private static WebDriver driver;
 private static String baseURL,nodeURL;
 public GridDriver(String  nodeURL,DesiredCapabilities capability) throws MalformedURLException{
 // TODO Auto-generated constructor stub
 this.driver =  new RemoteWebDriver(new URL(nodeURL),capability);
 public static void main (String[] ars) throws MalformedURLException, InterruptedException{
 baseURL = "";
 //nodeURL = "";
 //new GridDriver("", setBrowserAndPlatform(driver,"firefox", Platform.LINUX));
 new GridDriver("", setBrowserAndPlatform(driver,"chrome", Platform.WINDOWS));
        //new GridDriver("", setBrowserAndPlatform(driver,"internet explorer", Platform.WINDOWS));
 // new GridDriver(driver, "", setBrowserAndPlatform("firefox", Platform.XP));
 WebElement element = (new WebDriverWait(driver, 10)).until(ExpectedConditions.presenceOfElementLocated("q")));
 private static DesiredCapabilities setBrowserAndPlatform(WebDriver driver,String browserName,Platform PlatformName){
 DesiredCapabilities capability = null; file =null;
 String pathToIEdriver ="C:\\Selenium_browser_Driver\\IEDriverServer_x64_2.52.2\\IEDriverServer.exe";
 String pathToChromedriver ="C:\\Selenium_browser_Driver\\chromedriver_win32\\chromedriver.exe";
 switch (browserName) {
 case "firefox":
 capability= DesiredCapabilities.firefox();
 case "internet explorer":
 // file = new;
 capability= DesiredCapabilities.internetExplorer();
 case "chrome":
 file = new;        
        System.setProperty("", file.getAbsolutePath());
 capability =;
 capability.setCapability("chrome.switches", Arrays.asList("--start-maximized"));
 return capability;

Hope this will help for newbie Smile . Best of luck for GRID.

Spread Your Knowledge About Selenium Tool.

Email: [You must be registered and logged in to see this link.]
Forum: [You must be registered and logged in to see this link.]


Posts : 379
Join date : 2009-07-30
Location : India

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum