groupon / Selenium-Grid-Extras

Simplify the management of the Selenium Grid Nodes and stabilize said nodes by cleaning up the test environment after the build has been completed
BSD 3-Clause "New" or "Revised" License
536 stars 209 forks source link

Impossible to registering the node to the hub with SetupTeardownProxy #152

Open mikyone opened 9 years ago

mikyone commented 9 years ago

Hello I got an error when on my log file. It seems if I add a new node with selenium grid extra pointing on my hub. I got this error below in the log. (I changed the ip address by XXX:XX:XX:XX).

16:52:37.429 INFO [17] org.openqa.grid.internal.utils.SelfRegisteringRemote - Registering the node to the hub: http://XXX:XX:XX:XX:4444/grid/register 16:52:37.444 INFO [17] org.openqa.grid.internal.utils.SelfRegisteringRemote - Couldn't register this node: Error sending the registration request: The hub responded with 500:Could not initialize class com.groupon.seleniumgridextras.grid.proxies.SetupTeardownProxy

My hub config file is

{
  "port": 4444,
  "newSessionWaitTimeout": 25000,
  "servlets": [
    "com.groupon.seleniumgridextras.grid.servlets.SeleniumGridExtrasServlet",
    "com.groupon.seleniumgridextras.grid.servlets.ProxyStatusJsonServlet"
  ],
  "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
  "throwOnCapabilityNotPresent": true,
  "nodePolling": 5000,
  "cleanUpCycle": 5000,
  "browserTimeout": 120000,
  "timeout": 120000,
  "maxSession": 5
}

And my node config file is :

{
  "capabilities": [
    {
      "seleniumProtocol": "WebDriver",
      "browserName": "firefox",
      "maxInstances": 3,
      "version": "37",
      "platform": "VISTA"
    },
    {
      "seleniumProtocol": "WebDriver",
      "browserName": "internet explorer",
      "maxInstances": 1,
      "version": "8",
      "platform": "VISTA"
    },
    {
      "seleniumProtocol": "WebDriver",
      "browserName": "chrome",
      "maxInstances": 3,
      "version": "43",
      "platform": "VISTA"
    }
  ],
  "configuration": {
    "proxy": "com.groupon.seleniumgridextras.grid.proxies.SetupTeardownProxy",
    "maxSession": 3,
    "port": 5555,
    "register": true,
    "unregisterIfStillDownAfter": 10000,
    "hubPort": 4444,
    "hubHost": "XXX:XX:XX:XX",
    "nodeStatusCheckTimeout": 10000,
    "downPollingLimit": 0
  },
  "loadedFromFile": "node_5555.json"
}

Do you have any clue ?

dimacus commented 9 years ago

Are you running your hub with Selenium Grid extras? Both node(s) and hub need to be run by it because they share some classes that are needed.

On Wed, Aug 12, 2015 at 3:44 PM, mikyone notifications@github.com wrote:

Hello I got an error when on my log file. It seems if I add a new node with selenium grid extra pointing on my hub. I got this error below in the log. (I changed the ip address by XXX:XX:XX:XX).

16:52:37.429 INFO [17] org.openqa.grid.internal.utils.SelfRegisteringRemote - Registering the node to the hub: http://XXX:XX:XX:XX:4444/grid/register 16:52:37.444 INFO [17] org.openqa.grid.internal.utils.SelfRegisteringRemote - Couldn't register this node: Error sending the registration request: The hub responded with 500:Could not initialize class com.groupon.seleniumgridextras.grid.proxies.SetupTeardownProxy

My hub config file is

{ "port": 4444, "newSessionWaitTimeout": 25000, "servlets": [ "com.groupon.seleniumgridextras.grid.servlets.SeleniumGridExtrasServlet", "com.groupon.seleniumgridextras.grid.servlets.ProxyStatusJsonServlet" ], "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher", "throwOnCapabilityNotPresent": true, "nodePolling": 5000, "cleanUpCycle": 5000, "browserTimeout": 120000, "timeout": 120000, "maxSession": 5 }

And my node config file is :

{ "capabilities": [ { "seleniumProtocol": "WebDriver", "browserName": "firefox", "maxInstances": 3, "version": "37", "platform": "VISTA" }, { "seleniumProtocol": "WebDriver", "browserName": "internet explorer", "maxInstances": 1, "version": "8", "platform": "VISTA" }, { "seleniumProtocol": "WebDriver", "browserName": "chrome", "maxInstances": 3, "version": "43", "platform": "VISTA" } ], "configuration": { "proxy": "com.groupon.seleniumgridextras.grid.proxies.SetupTeardownProxy", "maxSession": 3, "port": 5555, "register": true, "unregisterIfStillDownAfter": 10000, "hubPort": 4444, "hubHost": "XXX:XX:XX:XX", "nodeStatusCheckTimeout": 10000, "downPollingLimit": 0 }, "loadedFromFile": "node_5555.json" }

Do you have any clue ?

— Reply to this email directly or view it on GitHub https://github.com/groupon/Selenium-Grid-Extras/issues/152.

-Dima Kovalenko

Good judgment comes from experience, and experience comes from bad judgment. --Frederick P. Brooks

mikyone commented 9 years ago

I made a test as a command line with jar and it works... I was trying to do it on intellij with the selenium project. I was wondering how do you embed the source code of selenium project in your own project ?

dimacus commented 9 years ago

There are 2 embeding points, a servlette (to give some code via browser, such a new console view or an API status endpoint) and proxy (which will allow you to hook into the execution of pre and post tests)

Here is an example of a Servlette, the commented out code would return a json file with a list of all connected nodes https://github.com/groupon/Selenium-Grid-Extras/blob/master/SeleniumGridExtras/src/main/java/com/groupon/seleniumgridextras/grid/servlets/ProxyStatusJsonServlet.java

Here is an example of a proxy, that hooks into pre/post test https://github.com/groupon/Selenium-Grid-Extras/blob/master/SeleniumGridExtras/src/main/java/com/groupon/seleniumgridextras/grid/proxies/SetupTeardownProxy.java

don't forget to check the grid's jar for the flags on how to attach the servlette and or proxies into a new instance of node or hub

On Wed, Aug 12, 2015 at 4:05 PM, mikyone notifications@github.com wrote:

I made a test as a command line with jar and it works... I was trying to do it on intellij with the selenium project. I was wondering how do you embed the source code of selenium project in your own project ?

— Reply to this email directly or view it on GitHub https://github.com/groupon/Selenium-Grid-Extras/issues/152#issuecomment-130428531 .

-Dima Kovalenko

Good judgment comes from experience, and experience comes from bad judgment. --Frederick P. Brooks