Selenium RemoteWebDriver立即崩溃InvalidOperaitonException

我正在尝试让selenium中枢工作。 每当我尝试创buildRemoteWebDriver时,它会崩溃与System.InvalidOperationException没有消息,InnerException等

我的机器在Windows 8.1上; 我正在使用docker工具箱运行一个集线器容器和两个节点容器(selenium/集线器和selenium/节点 – 火狐)。 (从长远来看,这些不会在我的本地主机上,但是我需要在创build一个更大的池之前在本地做一个概念validation)

我的代码:

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); } 

我很确定中心URI是正确的 – 去http://192.168.99.100:4444/wd/hub给我一些JSON,和http://192.168.99.100:4444/grid/console显示一个控制台2远程代理连接。

堆栈跟踪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) 

我已经尝试过的事情:

  • 最新的Selenium(3.5.0)和3.3.0读取Selenium RemoteWebDriver后c# – System.InvalidOperationException – 我改变了从C#项目引用的dll和docker容器的版本。
  • 改变能力。

任何人有任何build议?

按要求编辑日志:

枢纽:

 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 osjsServletContextHandler@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节点:

 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 osjsServletContextHandler@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 

这当然看起来像集线器与节点通信有困难。 我是新来的docker工人 这些是我用来启动它们的命令(基于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 

正如我所说,这是在Windows 8.1上的docker工具箱,如果这有所作为