Selenium RemoteWebDriver немедленно вылетает с InvalidOperaitonException

Я пытаюсь заставить Selenium Hub работать. Всякий раз, когда я пытаюсь создать RemoteWebDriver, он вылетает с System.InvalidOperationException без сообщения, InnerException и т. д.

Моя машина на Windows 8.1; Я использую набор инструментов докера для запуска контейнера-концентратора и контейнеров с двумя узлами (selenium/hub и selenium/node-firefox). (В долгосрочной перспективе их не будет на моем локальном хосте, но мне нужно провести проверку концепции локально, прежде чем создавать более крупный пул)

Мой код:

   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 показывает консоль с двумя подключенными удаленными прокси.

Трассировка стека исключения:

   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 — я изменил как библиотеки DLL, на которые есть ссылки в проекте C#, так и версии контейнеров докеров.
  • Изменение возможностей.

У кого-нибудь есть предложения?

Изменить журналы в соответствии с запросом:

Центр:

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:

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

Это определенно похоже на то, что у концентратора возникают проблемы со связью с узлом. Я новичок в докере; это команды, которые я использовал для их запуска (на основе 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, если это имеет значение.


person Stuart Moore    schedule 11.08.2017    source источник
comment
Не могли бы вы поделиться журналами консоли с узла, когда вы видите это исключение в своем C# коде? Это должно помочь нам лучше понять вашу неудачу.   -  person Krishnan Mahadevan    schedule 12.08.2017
comment
Журналы из докера, представленные выше, заставляют меня думать, что это проблема узла докера/селена, а не проблема С#.   -  person Stuart Moore    schedule 14.08.2017
comment
Поэтому я также сталкиваюсь с проблемами при запуске сетки селена на 3.5 (selenium.webdriver, selenium.support и автономный сервер). Эта ошибка задокументирована, и разработчики знают о ней. github.com/SeleniumHQ/selenium/issues/4443. Что-то еще, что вы могли бы попробовать, это использовать ICapabilities вместо DesiredCapabilities. Насколько я понимаю, DesiredCapabilities — это старый способ подачи кепок, и теперь мы должны использовать ICapabilities. Самый простой способ сделать это что-то вроде FirefoxOptions ffoptions = new FirefoxOpitons(); var cap = ffoptions.ToCapabilites();   -  person Buster    schedule 15.08.2017