node.jsjsonselenium-webdriverselenium-gridselenium-grid2

My test is getting failed when i try to execute on "Linux/XP/etc" platforms using Selenium Grid


i'm new to this Selenium grid.. my node is default registered on Win10 platform.. so it is executing the script without any issue. But when i tried to run on Other than Win10 it is getting failed. can someone please help me how to resolve this. i reviewed all the solutions available in internet but i'm not able to resolve it.

Code

  baseURL = "http://demo.guru99.com/test/guru99home/";
         nodeURL = "http://192.168.1.4:4444/wd/hub";
         ChromeOptions options=new ChromeOptions();
         DesiredCapabilities cap=DesiredCapabilities.chrome();
         cap.setPlatform(Platform.LINUX);
         options.merge(cap);
         driver = new RemoteWebDriver(new URL(nodeURL), options);

Error

15:02:08.893 INFO [RequestHandler.process] - Got a request to create a new session: Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}, platform: LINUX, version: }
15:02:08.912 INFO [RequestHandler.process] - Error forwarding the new session cannot find : Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}, platform: LINUX, version: }
org.openqa.grid.common.exception.CapabilityNotPresentOnTheGridException: cannot find : Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}, platform: LINUX, version: }
        at org.openqa.grid.internal.ProxySet.verifyAbilityToHandleDesiredCapabilities(ProxySet.java:153)
        at org.openqa.grid.internal.DefaultGridRegistry.addNewSessionRequest(DefaultGridRegistry.java:217)
        at org.openqa.grid.web.servlet.handler.RequestHandler.process(RequestHandler.java:111)
        at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:85)
        at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:69)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:865)
        at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:535)
        at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
        at org.seleniumhq.jetty9.security.SecurityHandler.handle(SecurityHandler.java:548)
        at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
        at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
        at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
        at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
        at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1340)
        at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
        at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:473)
        at org.seleniumhq.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:1564)
        at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
        at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1242)
        at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
        at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
        at org.seleniumhq.jetty9.server.Server.handle(Server.java:503)
        at org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:364)
        at org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:260)
        at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
        at org.seleniumhq.jetty9.io.FillInterest.fillable(FillInterest.java:103)
        at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
        at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
        at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
        at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
        at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
        at org.seleniumhq.jetty9.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
        at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
        at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
        at java.lang.Thread.run(Unknown Source)

Node.Json file

{
  "capabilities":
  [
    {
      "browserName": "firefox",
      "maxInstances": 5,
      "seleniumProtocol": "WebDriver"
    },
    {
      "browserName": "chrome",
      "maxInstances": 5,
      "seleniumProtocol": "WebDriver"
    },
    {
      "browserName": "internet explorer",
      "maxInstances": 1,
      "seleniumProtocol": "WebDriver"
    }
  ],
  "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
  "maxSession": 5,
  "port": 5555,
  "register": true,
  "registerCycle": 5000,
  "hub": "http://localhost:4444",
  "nodeStatusCheckTimeout": 5000,
  "nodePolling": 5000,
  "role": "node",
  "unregisterIfStillDownAfter": 60000,
  "downPollingLimit": 2,
  "debug": false,
  "servlets" : [],
  "withoutServlets": [],
  "custom": {}
}

if i need to add the capabilities for the other platforms where i have to add those capabilities.


Solution

  • This one solved my problem.

    java -jar "C:\Users\DELL\Desktop\Selenium Grid\selenium-server-standalone-3.141.5.jar" -role node -hub http://*.*.*.*:PortNumber/grid/register -port 5557 -browser "browserName=chrome,platform=LINUX"
    

    note: Place your Ip address in place of " * "

    and also check the node URL Port number.