Error forwarding the new session: Selenium Grid 2

最后都变了- 提交于 2020-01-11 03:57:04

问题


I have taken latest Selenium Server which is 2.45.0 from here. Followed the documentation and started the hub with the following command

java -jar selenium-server-standalone-2.45.0.jar -role hub -hubConfig HubConfigFile.json

And, the JSon file content is:

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

And, the only Node with

java -jar selenium-server-standalone-2.45.0.jar -role node -nodeConfig DefaultNode.json

{
  "capabilities":
      [
        {
          "browserName": "*firefox",
          "maxInstances": 5,
          "seleniumProtocol": "Selenium"
        },
        {
          "browserName": "*googlechrome",
          "maxInstances": 5,
          "seleniumProtocol": "Selenium"
        },
        {
          "browserName": "*iexplore",
          "maxInstances": 1,
          "seleniumProtocol": "Selenium"
        },
        {
          "browserName": "firefox",
          "maxInstances": 5,
          "seleniumProtocol": "WebDriver"
        },
        {
          "browserName": "chrome",
          "maxInstances": 5,
          "seleniumProtocol": "WebDriver"
        },
        {
          "browserName": "internet explorer",
          "maxInstances": 1,
          "seleniumProtocol": "WebDriver"
        }
      ],
  "configuration":
  {
    "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
    "maxSession": 5,
    "port": 5555,
    "host": 10.5.0.161,
    "register": true,
    "registerCycle": 5000,
    "hubPort": 4444,
    "hubHost": 10.5.0.21
  }
}

Up to this everything looks great. See the screenshots of the console after registering here

And, the problem start when I am trying to kick-off the test with:

DesiredCapabilities capabilities = DesiredCapabilities.InternetExplorer();
capabilities.SetCapability("browserName", "internet explorer");
capabilities.SetCapability("platform", "XP");
capabilities.SetCapability("version", "8.0");
//capabilities.SetCapability("seleniumProtocol", "WebDriver");

Driver = new RemoteWebDriver(new Uri("http://10.5.0.21:4444/wd/hub"), capabilities);

And, it throws:

An exception of type 'System.InvalidOperationException' occurred in WebDriver.dll but was not handled in user code

Additional information: Error forwarding the new session cannot find : Capabilities [{browserName=internet explorer, version=8.0, platform=XP}]

See the screenshots screenshot 1 screenshot 2 screenshot 3

I must say the documentation on Selenium Grid is very frustrating. I have spent whole day trying to figure out what's going wrong.

Am I missing something?


回答1:


After a good amount of research I was able to solve the issue. The command line parameter was wrong since I am using WebDriver I had to replace

java -jar selenium-server-standalone-2.45.0.jar -role node -nodeConfig DefaultNode.json

with

java -jar selenium-server-standalone-2.45.0.jar -role webdriver -nodeConfig DefaultNode.json -Dwebdriver.ie.driver=.\IEDriverServer.exe

which makes sure I have the driver executable set up in correct directory as well.



来源:https://stackoverflow.com/questions/28842774/error-forwarding-the-new-session-selenium-grid-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!