Advance Selenium

Complete setup of Selenium Grid 2.0 with Hub and Node setup

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://vistasadprojects.com/mukeshotwani-blogs-v2/");

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

 

author-avatar

About Mukesh Otwani

I am Mukesh Otwani working professional in a beautiful city Bangalore India. I completed by BE from RGPV university Bhopal. I have passion towards automation testing since couple of years I started with Selenium then I got chance to work with other tools like Maven, Ant, Git, GitHub, Jenkins, Sikuli, Selenium Builder etc.

60 thoughts on “Complete setup of Selenium Grid 2.0 with Hub and Node setup

  1. anandhu says:

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

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

  2. Dharma says:

    HI
    how we can change the os in node

    1. Hi Dharma,

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

  3. Jaime Jesus Martinez says:

    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?

    1. 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 https://vistasadprojects.com/mukeshotwani-blogs-v2/parallel-execution-in-selenium/

  4. Pratilipi behera says:

    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

    1. Hi Pratilipi,

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

  5. SRikanth says:

    Thank you!

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

    1. Hi Srikanth,

      Kindly elaborate on your concern…

      1. anandh says:

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

        it should be console not consoles right?

        1. Hi Anandh,

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

  6. Nick B says:

    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.

    1. Hi Nick,

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

  7. vamsi chava says:

    can you show for selenium standalone sever 3.0.1

  8. Sandeep says:

    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?

    1. Yes Sandeep same jar you can use for both

  9. Mohana says:

    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

    1. Hi Mohana,

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

  10. sudha says:

    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.

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

  11. Rafael García León says:

    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!

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

  12. Karloz says:

    Hey Mukesh,

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

    Thanks,
    Carlos

    1. Hi Carlos,

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

      1. Carlos says:

        Hey Mukesh,

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

        Thanks in advance

        1. Hi Carlos,

          Use batch command nslookup for respective machine

  13. muthuvel says:

    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

    1. Your most welcome Mate 🙂

  14. Preetish Kumar Mahato says:

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

    1. You can change port number while creating node.

  15. Preethi says:

    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

    1. Hi Preethi,

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

  16. 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!

    1. Hi Pham,

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

  17. Satya says:

    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.

    1. Rakesh says:

      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

      1. Hi rakesh,

        port is missing. kindly check again

  18. Somanath says:

    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

    1. Hi Somnath,

      Kindly try the same with Selenium 3

      1. somanath says:

        thanks mukesh

  19. Sohail says:

    Another Great tutorial with great explanation.

  20. Bimlesh says:

    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)

    1. Hi Bimlesh,

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

      1. Bimlesh says:

        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.

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

  21. Vijay Hugar says:

    Another great tutorial by Mukesh . Fantastic !

  22. Pradeep says:

    Thanks Mukesh.That’s a nice tutorial….

    1. Welcome pradeep 🙂

  23. Prakash says:

    Thanks a lot Mukesh…

  24. gopal says:

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

    1. Hey Gopal,

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

  25. Aruna says:

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

    1. Hey Aruna ,

      Thanks 🙂 keep visiting

Leave a 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.