• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • Programming Languages
    • Java Tutorials
    • Python Tutorials
    • JavaScript Tutorials
  • Automation Tools and Different Tools
    • Web Automation
      • Selenium with Java
        • Selenium Basic
        • Selenium Advance
        • Selenium Realtime
        • Framework
        • Selenium Interview
        • Selenium Videos
        • Selenium with Docker
      • Selenium with Python
      • WebdriverIO
        • Selenium Webdriver C# Tutorial
      • Cypress
      • Playwright
    • TestNG
    • Cucumber
    • Mobile Automation
      • Appium
    • API Testing
      • Postman
      • Rest Assured
      • SOAPUI
    • testRigor
    • Katalon
    • TestProject
    • Serenity BDD
    • Gradle- Build Tool
    • RPA-UiPath
    • Protractor
    • Windows Automation
  • Automation For Manual Testers
  • Services
  • Online Training
  • Contact us
  • About me
  • Follow us
    • Linkedin
    • Facebook Group
    • Facebook Page
    • Instagram

Automation

Selenium WebDriver tutorial Step by Step

You are here: Home / Advance Selenium / Complete setup of Selenium Grid 2.0 with Hub and Node setup

Complete setup of Selenium Grid 2.0 with Hub and Node setup

July 27, 2016 by Mukesh Otwani 60 Comments

Selenium grid has introduced in Selenium RC itself and it is known as Selenium Grid 1.0 if you are using with Selenium RC. We can use Selenium Grid for remote execution on the different platform.This article will Guide you how to use Selenium grid in selenium webdriver.

What is Selenium Grid

Selenium grid is the concept which will allow you to run your test on multiple machines and on multiple browsers. Selenium grid will actually help you run the test on multiple nodes which will reduce the total execution time which is the main advantage of Test Automation.

Let me explain through an example- Let’s say you have 1 script which you need to run on MAC, Linux, Unix and Windows then you have 2 approaches.

1- Setup the complete infrastructure in every machine to run test (not recommended)

2- Setup the grid environment to run test on all platform with the help of Node and Hub concept (Recommended)

To understand the Selenium grid we need to understand HUB and NODE concept which will actually help you to create grid environment.

 

Hub – Hub will be the central machine which will redirect the commands to the respective node based on parameter

Node- Node will be the actual machine where the test will be executed.

 

Youtube Video for Selenium Grid

 

Below diagram will actually represent the Grid concept.

Selenium grid in selenium webdriver

 

Above image explains you Selenium hub can redirect the command to the respective node based on parameters.

 

Selenium grid in selenium webdriver

How to start Selenium Hub

Before proceeding further you should have selenium server standalone jar in your local machine because this jar file only will create Selenium hub and Selenium node for test execution.

If you do not have selenium server then you can download from their official site

 

Selenium grid in selenium webdriver

 

Once the file is downloaded you can start with hub creation.

Open CMD and execute below command

java -jar selenium-server-standalone-2.53.1.jar -role hub

Selenium Grid for remote execution

Hit enter and you will get grid is up and running

Selenium Grid for remote execution

Once Selenium hub  is ready then you can check the status on the browser as well.

Open http://localhost:4444/grid/consoles on local browser and hit enter

You will get below screen with no node connected

Selenium Grid for remote execution

Now we need to create node and hub will manage the nodes.Let’s create a node and then we will trigger the test on the node.

How to start Selenium node

To start the node execute below command and it will start the node

java -jar selenium-server-standalone-2.53.1.jar -role node  -hub http://localhost:4444/grid/register

Selenium Grid for remote execution

Selenium Grid for remote execution

 

Once node is connected just open the hub Dashboard and you can see node is connected and you can see the webdriver and RC instances

By default, once node is created you will get 11 instances for WebDriver and 11 Instance of  RC

5 Firefox, 5 Chrome and 1 IE browser

It means you can run 5 FF,5 Chrome, and 1 IE browser if you want to run more test on this browser then you can change from the command line while creating the node.

Selenium Grid for remote execution

Selenium Grid for remote execution

Now we can start implementing part, we have to use RemoteWebDriver to execute our test on grid environment. We also have to use DesiredCapability class to specify platform name and browsers as well.

 

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.Test;

public class SeleniumGridTest 
{

@Test
public void runFirefox() throws MalformedURLException
{

// We have to mention browser which we want to use for test execution
DesiredCapabilities cap=DesiredCapabilities.firefox();

// Set the platform where we want to run our test- we can use MAC and Linux and other platforms as well
cap.setPlatform(Platform.WINDOWS);

// Here you can use hub address, hub will take the responsibility to execute the test on respective node
URL url=new URL("http://localhost:4444/wd/hub");

// Create driver with hub address and capability
WebDriver driver=new RemoteWebDriver(url, cap);

// start application
driver.get("https://learn-automation.com/");

// get the title and print the same
System.out.println("Blog title is "+driver.getTitle());

driver.close();

}

}

 

Console output

Once test will execute you can see all the commands on node cmd.

Selenium grid in selenium webdriver

 

Some point to remember while using Selenium Grid for remote execution

  • In above example, I used windows as the platform but you can use any platform.
  • I have used firefox as browser but you can use any other browser Chrome and IE etc
  • You can use Selenium grid for parallel execution as well.
  • If you do not have the environment to run the test then you can use Cloud-based environment like Browser Stack and Sauce lab which will allow you to run the test on their cloud.

 

Filed Under: Advance Selenium Tagged With: Grid

Reader Interactions

Comments

  1. anandhu says

    January 7, 2020 at 11:27 AM

    So for Selenium grid, we wont need to use the Chromedriver.exe/Gekodriver.exe file?

    Reply
    • Mukesh Otwani says

      January 7, 2020 at 12:58 PM

      Hi Anandhu,

      Selenium grid will take care of drivers. Only thing which you need to take care of is, corresponding browsers should be installed on node machines.

      Reply
  2. Dharma says

    December 27, 2019 at 4:40 PM

    HI
    how we can change the os in node

    Reply
    • Mukesh Otwani says

      December 28, 2019 at 7:30 AM

      Hi Dharma,

      You can provide OS platform name as parameter while setting up RemoteWebDriver capabilities

      Reply
  3. Jaime Jesus Martinez says

    December 3, 2019 at 12:20 AM

    Hello Mukesh:

    So I can run now the code into BrowserStack, but…
    How can I run or open more than one Virtual machine in the same execution?
    It is the same code but I need to run it in many virtual machines…
    Need I create one class for each virtual machine? Or how can I do it?

    Reply
    • Mukesh Otwani says

      December 3, 2019 at 2:26 PM

      Hi Jamie,

      If you are using BrowserStack for execution then you can trigger your scripts parallel. Parallel execution you can achieve via TestNG. Please check this link http://learn-automation.com/parallel-execution-in-selenium/

      Reply
  4. Pratilipi behera says

    November 18, 2019 at 10:53 AM

    Hi mukesh,

    For this Hub and node setup, do we need to physically connect the machines, like with ethernet ? if not, then how the selenium server will find the node connected to Hub?

    Thanks in Advance
    Pratilipi

    Reply
    • Mukesh Otwani says

      November 18, 2019 at 5:27 PM

      Hi Pratilipi,

      Both Server and node should be on same network. You should be able to ping both machines back and forth

      Reply
  5. SRikanth says

    November 3, 2019 at 1:30 PM

    Thank you!

    Can you please correct the url: http://localhost:4444/grid/console

    Reply
    • Mukesh Otwani says

      November 3, 2019 at 4:06 PM

      Hi Srikanth,

      Kindly elaborate on your concern…

      Reply
      • anandh says

        January 7, 2020 at 11:29 AM

        You have written “Open http://localhost:4444/grid/consoles on local browser and hit enter”

        it should be console not consoles right?

        Reply
        • Mukesh Otwani says

          January 7, 2020 at 12:46 PM

          Hi Anandh,

          Yes, it should be console(typo). You can see it in browser URL bar screenshot

          Reply
  6. Nick B says

    April 25, 2019 at 4:56 AM

    Is there a way to pass parameter values into the node’s native environment prior to execution?

    Specifically, looking for how to push Jenkins parameters into the Node so I can read them from my code.

    I am thinking there ought to be a way to collect the job parms using Jenkins (“build w/parameters”), then execute a batch file or something as a pre-build step that sets them into the windows environment, which I can then use system.getproperties to read.

    Any other means is acceptable, too. That just seems straightforward.

    Reply
    • Mukesh Otwani says

      April 25, 2019 at 6:38 PM

      Hi Nick,

      May be this plugin will help https://plugins.jenkins.io/envinject
      Kindly check plugin compatibility with your existing Jenkins version.

      Reply
  7. vamsi chava says

    February 16, 2017 at 5:40 AM

    can you show for selenium standalone sever 3.0.1

    Reply
    • Mukesh Otwani says

      February 16, 2017 at 11:35 AM

      will update soon.

      Reply
  8. Sandeep says

    January 17, 2017 at 3:55 PM

    Hi Mukesh,

    Can you explain the usage of selenium-server-x.xx.x.jar.
    Can we use this as standalone jar to configure node or hub?

    Reply
    • Mukesh Otwani says

      January 19, 2017 at 12:29 PM

      Yes Sandeep same jar you can use for both

      Reply
  9. Mohana says

    January 17, 2017 at 1:36 PM

    Hi Mukesh,

    We have an application which is launched in my local machine with the url http://localhost:3000 where i have to run my selenium tests.

    Now i want to try running the same set of scripts from my PC as well as another windows PC.

    Is it possible with remote driver concept?

    If yes, could you please share the procedure to do it.

    Thanks,
    Mohanapriya D

    Reply
    • Mukesh Otwani says

      January 19, 2017 at 2:05 PM

      Hi Mohana,

      You can access the application using url http://:3000

      Reply
  10. sudha says

    January 11, 2017 at 12:39 PM

    Hi Mukesh,

    When i execute my script in parallel execution in same browser, first script working fine, in second script launch the url after they i will closed immediately, with out start execution. using hub and node concept.

    Reply
    • Mukesh Otwani says

      January 11, 2017 at 2:25 PM

      Hi Sudha,

      Sometimes it happens when we run parallel execution on same browser that too on same machine. Driver reserves port number from machine for execution. Acquisition of port number sometimes fails due to which few fails

      Reply
  11. Rafael García León says

    December 27, 2016 at 9:51 PM

    Hi Mukesh,

    Thanks for your work. Its excellent!!
    I have two machine with differents SO.
    MachineA windows 7 and browser firefox and MachineB with ubuntu console.
    I want run executing test in MachineB that open browser firefox from MachineA. Any idea???
    Thanks for all!

    Reply
    • Mukesh Otwani says

      December 28, 2016 at 11:20 AM

      Hi Rafael,

      You can not open browser from different machine. In your case, you can send request to hub with OS and browser information. If any machine matches with information then hub will start the session on that machine.

      Reply
  12. Karloz says

    December 1, 2016 at 1:15 AM

    Hey Mukesh,

    Do you know how to get the node hostname from WebDriver ?

    Thanks,
    Carlos

    Reply
    • Mukesh Otwani says

      December 6, 2016 at 12:37 PM

      Hi Carlos,

      When you open hub url in browser then you can see all the nodes and hostname.

      Reply
      • Carlos says

        January 19, 2017 at 7:56 PM

        Hey Mukesh,

        Thanks for your reply. Sorry I meant to ask how to programmatically get the hostname via Webdriver API .

        Thanks in advance

        Reply
        • Mukesh Otwani says

          January 20, 2017 at 12:30 PM

          Hi Carlos,

          Use batch command nslookup for respective machine

          Reply
  13. muthuvel says

    November 23, 2016 at 4:45 PM

    hi mukesh really your vidoes are Awesome if i have doubts in selenium first i have see your video only thank you so much for posting this videos

    Reply
    • Mukesh Otwani says

      December 6, 2016 at 2:25 PM

      Your most welcome Mate 🙂

      Reply
  14. Preetish Kumar Mahato says

    October 12, 2016 at 1:12 AM

    mukesh when i am am running on grid
    java.net.BindException: selenium is already running on port 5555. Or some other service is.

    Reply
    • Mukesh Otwani says

      October 12, 2016 at 11:39 AM

      You can change port number while creating node.

      Reply
  15. Preethi says

    September 27, 2016 at 2:43 AM

    Hi Mukesh,
    It is very useful.But i am getting the below error message can you please help me on this.

    Exception in thread “main” java.lang.UnsupportedClassVersionError

    Reply
    • Mukesh Otwani says

      September 29, 2016 at 10:54 AM

      Hi Preethi,

      While using grid make sure java version is same in node and in hub.

      Reply
  16. Pham Duy Thong says

    September 21, 2016 at 5:38 PM

    How to me create node when i put hub at other network?. it mean i want setup hub and note not same network. Plz help me! Thanks you!

    Reply
    • Mukesh Otwani says

      September 29, 2016 at 2:34 PM

      Hi Pham,

      You can use IP address if you are using node and hub in different network.

      Reply
  17. Satya says

    August 16, 2016 at 6:57 PM

    Hi Mukesh,

    Thanks for the wonderful tutorial.

    I am receiving the following error. Could you please advise the problem in this and what else I need to do to overcome this.

    FAILED: runFirefox
    org.openqa.selenium.WebDriverException: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases
    Command duration or timeout: 325 milliseconds
    Build info: version: ‘2.53.1’, revision: ‘a36b8b1’, time: ‘2016-06-30 17:37:03’
    System info: host: ‘CFWIN2012-***’, ip: ‘**.*.0.*’, os.name: ‘Windows Server 2012 R2’, os.arch: ‘amd64’, os.version: ‘6.3’, java.version: ‘1.8.0_91’
    Driver info: org.openqa.selenium.remote.RemoteWebDriver

    Thanks.

    Reply
    • Mukesh Otwani says

      August 18, 2016 at 9:39 AM

      Hi Satya,

      Uddate java to JAVA 8 and use Selenium 3 now and then follow below post http://learn-automation.com/use-firefox-selenium-using-geckodriver-selenium-3/

      Reply
    • Rakesh says

      September 3, 2016 at 12:55 PM

      public class TestNode {
      @Test
      public void grid() throws MalformedURLException
      {
      DesiredCapabilities cap=DesiredCapabilities.firefox();
      cap.setPlatform(Platform.WINDOWS);
      URL url=new URL(“http://localhost/wd/hub”);
      WebDriver driver=new RemoteWebDriver(url, cap);
      //driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
      driver.get(“http://www.google.com”);
      String title = driver.getTitle();
      System.out.println(title);
      }

      I wrote above code but it gives me one exception

      org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
      Build info: version: ‘2.53.1’, revision: ‘a36b8b1’, time: ‘2016-06-30 17:32:46’
      System info: host: ‘Admin-PC’, ip: ‘192.168.1.4’, os.name: ‘Windows 7’, os.arch: ‘amd64’, os.version: ‘6.1’, java.version: ‘1.8.0_51’
      Driver info: driver.version: RemoteWebDriver
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:665)
      at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
      at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131)
      at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:158)
      at gridConcept.TestNode.grid(TestNode.java:20)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:497)
      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
      at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)
      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)
      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
      at org.testng.TestRunner.privateRun(TestRunner.java:774)
      at org.testng.TestRunner.run(TestRunner.java:624)
      at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
      at org.testng.SuiteRunner.run(SuiteRunner.java:261)
      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)
      at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
      at org.testng.TestNG.run(TestNG.java:1048)
      at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:112)
      at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:205)
      at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:176)
      Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:80 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
      at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:151)
      at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
      at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
      at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
      at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
      at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
      at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
      at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
      at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
      at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
      at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:144)
      at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:90)
      at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:644)
      … 28 more
      Caused by: java.net.ConnectException: Connection refused: connect
      at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
      at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
      at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
      at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
      at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
      at java.net.Socket.connect(Socket.java:589)
      at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74)
      at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
      … 41 more

      Reply
      • Mukesh Otwani says

        September 8, 2016 at 12:01 AM

        Hi rakesh,

        port is missing. kindly check again

        Reply
  18. Somanath says

    August 10, 2016 at 3:02 PM

    hi mukesh,
    after configure the setting i am getting bellow issues
    Microsoft Windows [Version 6.3.9600]
    (c) 2013 Microsoft Corporation. All rights reserved.

    C:\Users\Kallol Das>java -jar D:\selenium-server-standalone-2.53.0.jar -role hub
    14:32:50.411 INFO – Launching Selenium Grid hub
    2016-08-10 14:32:52.378:INFO::main: Logging initialized @2432ms
    14:32:52.419 INFO – Will listen on 4444
    14:32:52.593 INFO – Will listen on 4444
    2016-08-10 14:32:52.605:INFO:osjs.Server:main: jetty-9.2.z-SNAPSHOT
    2016-08-10 14:32:52.707:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@556333{/,null,AVAILABLE}
    2016-08-10 14:32:52.726:WARN:osjuc.AbstractLifeCycle:main: FAILED ServerConnector@1fc5fb8{HTTP/1.1}{0.0.0.0:4444}: java.
    net.BindException: Address already in use: bind
    java.net.BindException: Address already in use: bind
    at sun.nio.ch.Net.bind0(Native Method)
    at sun.nio.ch.Net.bind(Unknown Source)
    at sun.nio.ch.Net.bind(Unknown Source)
    at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
    at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
    at org.seleniumhq.jetty9.server.ServerConnector.open(ServerConnector.java:321)
    at org.seleniumhq.jetty9.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
    at org.seleniumhq.jetty9.server.ServerConnector.doStart(ServerConnector.java:236)
    at org.seleniumhq.jetty9.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.seleniumhq.jetty9.server.Server.doStart(Server.java:366)
    at org.seleniumhq.jetty9.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.openqa.grid.web.Hub.start(Hub.java:192)
    at org.openqa.grid.selenium.GridLauncher$2.launch(GridLauncher.java:74)
    at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:127)
    2016-08-10 14:32:52.729:WARN:osjuc.AbstractLifeCycle:main: FAILED org.seleniumhq.jetty9.server.Server@7aecef: java.net.B
    indException: Address already in use: bind
    java.net.BindException: Address already in use: bind
    at sun.nio.ch.Net.bind0(Native Method)
    at sun.nio.ch.Net.bind(Unknown Source)
    at sun.nio.ch.Net.bind(Unknown Source)
    at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
    at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
    at org.seleniumhq.jetty9.server.ServerConnector.open(ServerConnector.java:321)
    at org.seleniumhq.jetty9.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
    at org.seleniumhq.jetty9.server.ServerConnector.doStart(ServerConnector.java:236)
    at org.seleniumhq.jetty9.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.seleniumhq.jetty9.server.Server.doStart(Server.java:366)
    at org.seleniumhq.jetty9.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.openqa.grid.web.Hub.start(Hub.java:192)
    at org.openqa.grid.selenium.GridLauncher$2.launch(GridLauncher.java:74)
    at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:127)

    ——————————-
    Running as a grid hub:
    ——————————-

    Usage: java -jar selenium-server.jar -role hub [options]

    -host:
    : usually not needed and determined
    automatically. For exotic network configuration, network with
    VPN, specifying the host might be necessary.

    -port:
    : the port the remote/hub will listen on. Default to 4444.

    -throwOnCapabilityNotPresent:
    default to true. If true, the hub will reject test
    requests right away if no proxy is currently registered that can
    host that capability.Set it to false to have the request queued
    until a node supporting the capability is added to the grid.

    -newSessionWaitTimeout:
    . Default to no timeout ( -1 ) the time in ms after which a
    new test waiting for a node to become available will time
    out.When that happens, the test will throw an exception before
    starting a browser.

    -capabilityMatcher:
    a class implementing the CapabilityMatcher interface. Defaults to
    org.openqa.grid.internal.utils.DefaultCapabilityMatcher. Specify
    the logic the hub will follow to define if a request can be
    assigned to a node.Change this class if you want to have the
    matching process use regular expression instead of exact match
    for the version of the browser for instance. All the nodes of a
    grid instance will use the same matcher, defined by the registry.

    -prioritizer:
    a class implementing the Prioritizer interface. Default to null (
    no priority = FIFO ).Specify a custom prioritizer if you need the
    grid to process the tests from the CI, or the IE tests first for
    instance.

    -servlets:
    to register a
    new servlet on the hub/node. The servlet will accessible under
    the path /grid/admin/MyServlet /grid/admin/MyServlet2

    -grid1Yml:
    a YML file following grid1 format.

    -hubConfig:
    a JSON file following grid2 format that defines the hub
    properties.

    -browserTimeout:
    The timeout in seconds a browser can hang

    This synopsis lists options available in hub role only. To get help
    on the command line options available for other roles run the server
    with -help name and the corresponding -role name value.
    java.net.BindException: Address already in use: bind
    at sun.nio.ch.Net.bind0(Native Method)
    at sun.nio.ch.Net.bind(Unknown Source)
    at sun.nio.ch.Net.bind(Unknown Source)
    at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
    at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
    at org.seleniumhq.jetty9.server.ServerConnector.open(ServerConnector.java:321)
    at org.seleniumhq.jetty9.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
    at org.seleniumhq.jetty9.server.ServerConnector.doStart(ServerConnector.java:236)
    at org.seleniumhq.jetty9.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.seleniumhq.jetty9.server.Server.doStart(Server.java:366)
    at org.seleniumhq.jetty9.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.openqa.grid.web.Hub.start(Hub.java:192)
    at org.openqa.grid.selenium.GridLauncher$2.launch(GridLauncher.java:74)
    at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:127)

    please tell me how to solve this issue

    Reply
    • Mukesh Otwani says

      August 18, 2016 at 10:02 AM

      Hi Somnath,

      Kindly try the same with Selenium 3

      Reply
      • somanath says

        August 20, 2016 at 9:59 PM

        thanks mukesh

        Reply
        • Mukesh Otwani says

          August 27, 2016 at 11:37 PM

          Welcome Mate

          Reply
  19. Sohail says

    August 7, 2016 at 12:40 PM

    Another Great tutorial with great explanation.

    Reply
    • Mukesh Otwani says

      August 18, 2016 at 10:45 PM

      Thanks Sohail

      Reply
  20. Bimlesh says

    August 4, 2016 at 5:51 PM

    Hi Mukesh,

    First of all, thanks for this great video and clear explanation.

    For the grid setup, I am able to configure the hub successfully by issuing the command

    java -jar “C:\Data\Bimlesh\Selenium\Zip Files\selenium-server-standalone-2.53.0.jar” -role hub which give me the message 17:35:08.676 INFO – Nodes should register to http://xxx.xxx.xx.xx:4444/grid/register/

    now when I am trying to register a node to this address by giving the command from a different machine in my office

    java -jar C:\Data\selenium-server-standalone-2.53.0.jar -role node -hub
    http://xxx.xxx.xx.xx:4444/grid/register/

    I get the message

    17:42:48.284 INFO – Launching a Selenium Grid node
    17:43:10.629 WARN – error getting the parameters from the hub. The node may end
    up with wrong timeouts.Connect to 192.168.30.14:4444 [/192.168.30.14] failed: Co
    nnection timed out: connect
    17:43:11.003 INFO – Java: Oracle Corporation 25.91-b14
    17:43:11.003 INFO – OS: Windows 7 6.1 x86
    17:43:11.003 INFO – v2.53.0, with Core v2.53.0. Built from revision 35ae25b
    17:43:11.034 INFO – Driver class not found: com.opera.core.systems.OperaDriver
    17:43:11.034 INFO – Driver provider com.opera.core.systems.OperaDriver is not re
    gistered
    17:43:11.034 INFO – Driver provider org.openqa.selenium.safari.SafariDriver regi
    stration is skipped:
    registration capabilities Capabilities [{browserName=safari, version=, platform=
    MAC}] does not match the current platform VISTA
    17:43:11.034 INFO – Driver class not found: org.openqa.selenium.htmlunit.HtmlUni
    tDriver
    17:43:11.034 INFO – Driver provider org.openqa.selenium.htmlunit.HtmlUnitDriver
    is not registered
    17:43:11.066 WARN – Failed to start: SocketListener0@0.0.0.0:5555

    ——————————-
    Running as a grid node:
    ——————————-

    Usage: java -jar selenium-server.jar -role node [options]

    -host:
    : usually not needed and determined
    automatically. For exotic network configuration, network with
    VPN, specifying the host might be necessary.

    -port:
    : the port the remote/hub will listen on. Default to 4444.

    -cleanupCycle:
    in ms. How often a proxy will check for timed out thread.

    -timeout:
    the timeout in seconds before the hub automatically ends
    a test that hasn’t had any activity in the last X seconds. The
    browser will be released for another test to use. This typically
    takes care of the client crashes.

    -browserTimeout:
    The timeout in seconds a browser can hang

    -hub:
    : the url that will be used
    to post the registration request. This option takes precedence
    over -hubHost and -hubPort options.

    -hubHost:
    : the host address of a hub the registration
    request should be sent to. Default to localhost. Option -hub
    takes precedence over this option.

    -hubPort:
    : the port listened by a hub the registration request
    should be sent to. Default to 4444. Option -hub takes precedence
    over this option.

    -proxy:
    the class that will be used to represent the node. By default
    org.openqa.grid.selenium.proxy.DefaultRemoteProxy.

    -maxSession:
    max number of tests that can run at the same time on the node,
    independently of the browser used.

    -registerCycle:
    how often in ms the node will try to register itself again.Allow
    to restart the hub without having to restart the nodes.

    -nodePolling:
    in ms. Interval between alive checks of node how often the hub
    checks if the node is still alive.

    -unregisterIfStillDownAfter:
    in ms. If the node remains down for more than
    unregisterIfStillDownAfter millisec, it will disappear from the
    hub.Default is 1min.

    -downPollingLimit:
    node is marked as down after downPollingLimit alive checks.

    -nodeStatusCheckTimeout:
    in ms. Connection and socket timeout which is used for node alive
    check.

    This synopsis lists options available in node role only. To get help
    on the command line options available for other roles run the server
    with -help name and the corresponding -role name value.
    java.net.BindException: Selenium is already running on port 5555. Or some other
    service is.
    at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:5
    09)
    at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:32
    1)
    at org.openqa.grid.internal.utils.SelfRegisteringRemote.startRemoteServe
    r(SelfRegisteringRemote.java:102)
    at org.openqa.grid.selenium.GridLauncher$3.launch(GridLauncher.java:92)
    at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:127)

    Reply
    • Mukesh Otwani says

      August 5, 2016 at 10:23 AM

      Hi Bimlesh,

      It is just proxy issue you can start node with proxy then it will connect to hub

      Reply
      • Bimlesh says

        August 5, 2016 at 1:06 PM

        Hi Mukesh,

        I had started the node on a machine which had my company’s proxy setup. Is there anything I need to change in the command when starting the node? Please advise.

        Reply
        • Mukesh Otwani says

          August 5, 2016 at 1:36 PM

          No only proxy has to set.

          I will suggest just try to ping the machine using ping command from CMD if ping is successful then you can connect node to hub.

          Reply
  21. Vijay Hugar says

    August 2, 2016 at 3:54 PM

    Another great tutorial by Mukesh . Fantastic !

    Reply
    • Mukesh Otwani says

      August 5, 2016 at 11:50 AM

      Thanks Vijay

      Reply
  22. Pradeep says

    August 2, 2016 at 1:22 PM

    Thanks Mukesh.That’s a nice tutorial….

    Reply
    • Mukesh Otwani says

      August 5, 2016 at 12:01 PM

      Welcome pradeep 🙂

      Reply
  23. Prakash says

    July 29, 2016 at 10:52 PM

    Thanks a lot Mukesh…

    Reply
    • Mukesh Otwani says

      August 2, 2016 at 12:31 PM

      Welcome Prakash

      Reply
  24. gopal says

    July 28, 2016 at 12:34 PM

    Hi Mukesh,

    Before your to your post on selenium gird i thought that grid is something different and difficult to learn but after watching video on Selenium Grid It is very use full and easy to implement the same. thank you so much.

    If it’s possible could you please post some videos on Protractor tool(Angular JS) .

    Reply
    • Mukesh Otwani says

      August 2, 2016 at 12:40 PM

      Hey Gopal,

      Yes it is possible but since I have not used protractor so not sure how 🙁

      Reply
  25. Aruna says

    July 27, 2016 at 4:22 PM

    Hi Mukesh,
    your vedios are awsome. Very very useful ……Thankyou

    Reply
    • Mukesh Otwani says

      July 27, 2016 at 5:28 PM

      Hey Aruna ,

      Thanks 🙂 keep visiting

      Reply

Leave a Reply Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Free Selenium Videos

https://www.youtube.com/watch?v=w_iPCT1ETO4

Search topic

Top Posts & Pages

  • Selenium Webdriver tutorial for beginners
  • How To Fix Eclipse Autocomplete Or Code Suggestion In Eclipse
  • Selenium Webdriver C# Tutorial
  • WHAT ARE YOUR EXPECTATIONS FROM US?

Stay connected via Facebook

Stay connected via Facebook

Archives

Footer

Categories

Recent Post

  • API Testing Using Postman And RestAssured
  • Disable Personalise Your Web Experience Microsoft Edge Prompt In Selenium
  • How To Fix Error: No tests found In Playwright
  • How To Fix Eclipse Autocomplete Or Code Suggestion In Eclipse
  • Best and easy way to Group test cases in selenium

Top Posts & Pages

  • Selenium Webdriver tutorial for beginners
  • How To Fix Eclipse Autocomplete Or Code Suggestion In Eclipse
  • Selenium Webdriver C# Tutorial
  • WHAT ARE YOUR EXPECTATIONS FROM US?