转发新会话时出错:Selenium Grid 2 [英] Error forwarding the new session: Selenium Grid 2

查看:164
本文介绍了转发新会话时出错:Selenium Grid 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从此处中获取了最新的Selenium Server,它是2.45.0.遵循文档并使用以下命令启动集线器

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

并且JSon文件内容为:

{
  "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
}

而且,唯一具有

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

然后,它抛出:

WebDriver.dll中发生了'System.InvalidOperationException'类型的异常,但未在用户代码中处理

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

其他信息:找不到新会话时转发错误:功能[{browserName = internetexplorer,版本= 8.0,平台= XP}]

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

请参见屏幕快照屏幕截图1 屏幕截图3

我必须说Selenium Grid上的文档非常令人沮丧.我花了整整一天的时间试图找出问题所在.

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

我想念什么吗?

推荐答案

经过大量研究,我终于能够解决问题.命令行参数错误,因为我正在使用WebDriver我必须替换

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

使用

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.

这篇关于转发新会话时出错:Selenium Grid 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆