0

I'm trying to get selenium hub to work. Whenever I try to create the RemoteWebDriver, it crashes with System.InvalidOperationException with no message, InnerException etc.

My machine is on Windows 8.1; I'm using docker toolbox to run a hub container and 2 node containers (selenium/hub and selenium/node-firefox). (In the longer term these wouldn't be on my localhost, but I need to do a proof of concept locally before creating a larger pool)

My code:

   var capabilities = DesiredCapabilities.Firefox();
   capabilities.SetCapability(CapabilityType.BrowserName,"firefox");
   capabilities.SetCapability(CapabilityType.Platform, new Platform(PlatformType.Any));
   //*** next line crashes creating the RemoteWebDriver
   using (IWebDriver driver = new RemoteWebDriver(new Uri("http://192.168.99.100:4444/wd/hub"), capabilities))
   {
       driver.Navigate().GoToUrl("http://www.google.com");

       Console.WriteLine(driver.Title);
   }

I'm pretty sure the hub URI is correct - going to http://192.168.99.100:4444/wd/hub gives me some json, and http://192.168.99.100:4444/grid/console shows a console with 2 remote proxies attached.

Stack trace of exception:

   at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(Uri remoteAddress, ICapabilities desiredCapabilities)

Things I have tried:

Anyone got any suggestions?

Edit Logs as requested:

Hub:

starting selenium hub with configuration:

{
  "host": null,
  "port": 4444,
  "prioritizer": null,
  "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher"
,
  "throwOnCapabilityNotPresent": true,
  "newSessionWaitTimeout": -1,
  "jettyMaxThreads": -1,
  "nodePolling": 5000,
  "cleanUpCycle": 5000,
  "timeout": 30,
  "browserTimeout": 0,
  "maxSession": 5,
  "unregisterIfStillDownAfter": 30000
}
16:59:08.081 INFO - Selenium build info: version: '3.3.0', revision: 'b526bd5'
16:59:08.082 INFO - Launching Selenium Grid hub
2017-08-14 16:59:08.672:INFO::main: Logging initialized @835ms to org.seleniumhq.jetty9.util.log.StdErrLog
16:59:08.685 INFO - Will listen on 4444
2017-08-14 16:59:08.753:INFO:osjs.Server:main: jetty-9.2.20.v20161216
2017-08-14 16:59:08.778:INFO:osjs.session:main: DefaultSessionIdManager workerName=node0
2017-08-14 16:59:08.785:INFO:osjs.session:main: No SessionScavenger set, using defaults
2017-08-14 16:59:08.789:INFO:osjs.session:main: Scavenging every 600000ms
2017-08-14 16:59:08.796:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@67e2d983{/,null,AVAILABLE}
2017-08-14 16:59:08.808:INFO:osjs.AbstractConnector:main: Started ServerConnector@5057acf0{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2017-08-14 16:59:08.809:INFO:osjs.Server:main: Started @972ms
16:59:08.809 INFO - Nodes should register to http://172.17.0.2:4444/grid/register/
16:59:08.809 INFO - Selenium Grid hub is up and running
16:59:20.077 INFO - Registered a node http://172.17.0.3:5555
16:59:30.254 INFO - Marking the node http://172.17.0.3:5555 as down: cannot reach the node for 2 tries
17:00:30.318 INFO - Unregistering the node http://172.17.0.3:5555 because it's been down for 60063 milliseconds
17:00:30.318 WARN - Cleaning up stale test sessions on the unregistered node http://172.17.0.3:5555
17:00:34.985 INFO - Registered a node http://172.17.0.3:5555
17:00:45.001 INFO - Marking the node http://172.17.0.3:5555 as down: cannot reach the node for 2 tries
17:01:45.057 INFO - Unregistering the node http://172.17.0.3:5555 because it's been down for 60056 milliseconds
17:01:45.057 WARN - Cleaning up stale test sessions on the unregistered node http://172.17.0.3:5555
17:01:45.070 INFO - Registered a node http://172.17.0.3:5555
17:01:55.089 INFO - Marking the node http://172.17.0.3:5555 as down: cannot reach the node for 2 tries
17:02:55.150 INFO - Unregistering the node http://172.17.0.3:5555 because it's been down for 60061 milliseconds
17:02:55.151 WARN - Cleaning up stale test sessions on the unregistered node http://172.17.0.3:5555
17:02:55.164 INFO - Registered a node http://172.17.0.3:5555
17:03:05.180 INFO - Marking the node http://172.17.0.3:5555 as down: cannot reach the node for 2 tries
17:04:05.256 INFO - Unregistering the node http://172.17.0.3:5555 because it's been down for 60076 milliseconds
17:04:05.256 WARN - Cleaning up stale test sessions on the unregistered node http://172.17.0.3:5555
17:04:10.259 INFO - Registered a node http://172.17.0.3:5555
17:04:20.271 INFO - Marking the node http://172.17.0.3:5555 as down: cannot reach the node for 2 tries

Firefox node:

16:59:19.483 INFO - Selenium build info: version: '3.3.0', revision: 'b526bd5'
16:59:19.483 INFO - Launching a Selenium Grid node
2017-08-14 16:59:19.915:INFO::main: Logging initialized @707ms to org.seleniumhq.jetty9.util.log.StdErrLog
16:59:19.961 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
 registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform LINUX
16:59:19.961 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:
 registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform LINUX
16:59:19.961 INFO - Driver class not found: com.opera.core.systems.OperaDriver
16:59:19.961 INFO - Driver provider com.opera.core.systems.OperaDriver registration is skipped:
Unable to create new instances on this machine.
16:59:19.962 INFO - Driver class not found: com.opera.core.systems.OperaDriver
16:59:19.962 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
16:59:19.963 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:
 registration capabilities Capabilities [{browserName=safari, version=, platform
=MAC}] does not match the current platform LINUX
2017-08-14 16:59:19.989:INFO:osjs.Server:main: jetty-9.2.20.v20161216
2017-08-14 16:59:20.022:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@441772e{/,null,AVAILABLE}
2017-08-14 16:59:20.033:INFO:osjs.AbstractConnector:main: Started ServerConnector@39a1a18e{HTTP/1.1,[http/1.1]}{0.0.0.0:5555}
2017-08-14 16:59:20.034:INFO:osjs.Server:main: Started @826ms
16:59:20.034 INFO - Selenium Grid node is up and ready to register to the hub
16:59:20.046 INFO - Starting auto registration thread. Will try to register every 5000 ms.
16:59:20.046 INFO - Registering the node to the hub: http://172.17.0.2:4444/grid/register
16:59:20.076 INFO - The node is registered to the hub and ready to use
16:59:25.217 INFO - SessionCleaner initialized with insideBrowserTimeout 0 and clientGoneTimeout 30000 polling every 3000
17:00:34.970 INFO - Registering the node to the hub: http://172.17.0.2:4444/grid/register
17:00:34.982 INFO - The node is registered to the hub and ready to use
17:01:45.061 INFO - Registering the node to the hub: http://172.17.0.2:4444/grid/register
17:01:45.070 INFO - The node is registered to the hub and ready to use
17:02:55.159 INFO - Registering the node to the hub: http://172.17.0.2:4444/grid/register
17:02:55.164 INFO - The node is registered to the hub and ready to use
17:04:10.243 INFO - Registering the node to the hub: http://172.17.0.2:4444/grid/register
17:04:10.257 INFO - The node is registered to the hub and ready to use
17:05:20.338 INFO - Registering the node to the hub: http://172.17.0.2:4444/grid/register
17:05:20.343 INFO - The node is registered to the hub and ready to use
17:06:30.422 INFO - Registering the node to the hub: http://172.17.0.2:4444/grid/register
17:06:30.428 INFO - The node is registered to the hub and ready to use

That certainly looks like the hub is having difficulty communicating with the node. I'm new to docker; these are the commands I used to start them (based on https://github.com/SeleniumHQ/docker-selenium ):

 docker run -d -p 4444:4444 --name selenium-hub selenium/hub:3.3.0
 docker run -d --link selenium-hub:hub selenium/node-firefox:3.3.0

As I say, this is docker toolbox on Windows 8.1 if that makes a difference

Stuart Moore
  • 681
  • 5
  • 32
  • 1
    Can you please share the console logs from the node when you see this exception in your `C#` code ? That should help us get more insights into your failure. – Krishnan Mahadevan Aug 12 '17 at 03:10
  • Logs from docker provided above, making me think this is a docker/selenium node issue rather than a C# issue – Stuart Moore Aug 14 '17 at 17:13
  • 1
    So I am facing issues starting selenium grid on 3.5 also (selenium.webdriver, selenium.support, and standalone-server). This bug is documented and developers are aware of it. https://github.com/SeleniumHQ/selenium/issues/4443. Something else you might wanna try is using `ICapabilities` instead of `DesiredCapabilities`. It is my understanding that `DesiredCapabilities` is the old way to submit caps and now we should use `ICapabilities`. The easiest way to do this is something like `FirefoxOptions ffoptions = new FirefoxOpitons(); var cap = ffoptions.ToCapabilites();` – Buster Aug 14 '17 at 22:05

0 Answers0