Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium GRID -- Session terminated due to TIMEOUT after less then 100 milliseconds when invoking WebDriver.getCurrentUrl()

I have a set of parallel tests which never have this problem when I run them locally. This only occurs on my piddly little two node grid. My tests are pretty consistently crapping out when I am trying to invoke WebDriver.getCurrentUrl(). The error message is this:

org.openqa.selenium.WebDriverException: Session [035e8f79-fdd7-4492-a565-f803df792d3c] was terminated due to TIMEOUT
Command duration or timeout: 90 milliseconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'bos-mpky6', ip: '172.30.31.59', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '1.8.0_102'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=46.0.1, platform=LINUX, nativeEvents=false, acceptSslCerts=true, webdriver.remote.sessionid=035e8f79-fdd7-4492-a565-f803df792d3c, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 035e8f79-fdd7-4492-a565-f803df792d3c

    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:701)
    at org.openqa.selenium.remote.RemoteWebDriver.getCurrentUrl(RemoteWebDriver.java:326)

At first, I thought this was a configuration problem, but I have configured my setup to have a a timeout much longer than a few milliseconds. Here is the configuration I use for the hub:

{
  "host": null,
  "port": 4444,
  "newSessionWaitTimeout": -1,
  "servlets" : [],
  "prioritizer": null,
  "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
  "throwOnCapabilityNotPresent": true,
  "nodePolling": 5000,
  "cleanUpCycle": 5000,
  "timeout": 300000,
  "browserTimeout": 0,
  "jettyMaxThreads":-1
}

Here is the configuration I am using for both my nodes:

{
   "capabilities":
   [
      {
         "browserName": "firefox",
         "version": "46.0.1",
         "platform": "LINUX",
         "maxInstances": 5
      }
   ],
   "configuration":
   {
       "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
       "nodeTimeout":500000,
       "port":5555,
       "nodePolling":2000,
       "registerCycle":10000,
       "register":true,
       "cleanUpCycle":2000,
       "timeout":500000
   }
}

I am not using Docker or anything like that. I have tried versions 2.53.1, 2.53.0, 2.52.0 and 2.51.0 of the grid server and the problem continues to plague my tests. Is there something I can do to get rid of this problem? I can't find a configuration setting related to timeouts that seems to get rid of this.

like image 395
Selena Avatar asked Oct 29 '22 19:10

Selena


1 Answers

I had the same error, when I adjusted the timeout and browserTimeout properties. My solution was to set the hub configuration back to default. But you already have the same like I do now.

BUT I've seen a slight difference in your node configuration. I'm using Windows 7 as node and this is my config:

{
  "capabilities": [
    {
      "browserName": "firefox",
      "maxInstances": 2,
      "takesScreenshot": true,
      "seleniumProtocol": "WebDriver"
    },
    {
      "browserName": "internet explorer",
      "maxInstances": 1,
      "version": "11",
      "webdriver.ie.driver": "<MOUNT>\Selenium\IEDriverServer_2.53.1_32bit",
      "takesScreenshot": true,
      "platform": "WINDOWS",
      "seleniumProtocol": "WebDriver"
    }
  ],
  "configuration": {
    "_comment" : "Configuration for Node",
    "cleanUpCycle":5000,
    "timeout": 500,
    "port": 8088,
    "hubHost": V0001172,
    "register": true,
    "hubPort": 8089,
    "maxSession": 1
  }
}

I added the seleniumProtocol to my node configuration. I can't remember where I found this, but in my setup it works.

like image 137
MarcelHodan Avatar answered Jan 02 '23 21:01

MarcelHodan