“在WebDriver.dll中发生类型为'System.InvalidOperationException'的未处理的异常".出现错误 [英] "An unhandled exception of type 'System.InvalidOperationException' occurred in WebDriver.dll" error coming up

查看:148
本文介绍了“在WebDriver.dll中发生类型为'System.InvalidOperationException'的未处理的异常".出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个简单的代码来启动Firefox浏览器. 在Visual Studio中运行它.下面是代码:

I am running a simple code to launch the Firefox browser. Running it in Visual Studio. Below is the code:

IWebDriver driver3 = new RemoteWebDriver(
          new Uri("http://localhost:4444/wd/hub"),
          DesiredCapabilities.Firefox());
driver3.Url = "http://www.google.com";

获取错误异常为:

WebDriver.dll中发生了类型为'System.InvalidOperationException'的未处理的异常 附加信息:转发新会话时出错,无法使用虚拟机虚拟机池设置功能[{browserName = firefox,version =,platform = ANY}]

An unhandled exception of type 'System.InvalidOperationException' occurred in WebDriver.dll Additional information: Error forwarding the new session Empty pool of VM for setup Capabilities [{browserName=firefox, version=, platform=ANY}]

任何人都可以告诉我如何解决此问题吗?
我已经做了以下事情:

Can anyone please tell me how to fix this?
I have done the following:

  1. 我正在运行一个硒网格,作为role = hub,以localhost:4444作为端口.
  2. 已在系统"属性中将PATH环境变量添加为"C:\ Program Files(x86)\ Mozilla Firefox \ firefox.exe"
  3. 我还尝试过降级硒罐版本,甚至浏览器版本,但没有结果.

任何人都可以告诉我们如何解决此问题吗?

Can anyone please tell how to fix this?

解决此问题的正确代码是什么?

What would be the correct code to fix this issue?

推荐答案

该异常意味着您的Selenium Grid没有任何具有所需功能的浏览器可用的节点.

That exception means that your Selenium Grid doesn't have any node available with a browser that has the desired capabilities.

如果您在计算机(-role hub)上以集线器的身份运行Selenium Grid,请确保至少有一个提供所需浏览器的 node 已连接到那个枢纽.检查 http://localhost:4444/grid/console 看看是否有任何节点连接到您的集线器.

If you're running Selenium Grid as a hub on your machine (-role hub) make sure that at least one node which provides the desired browser is connected to that hub. Check out http://localhost:4444/grid/console to see whether any nodes are connected to your hub.

此外,您可以通过启动独立服务器而将其作为集线器和节点一起运行,而无需指定role:java -jar selenium-server-standalone-3.0.1.jar

Also, you could just run the standalone server as a hub and a node together by starting it without specifying a role: java -jar selenium-server-standalone-3.0.1.jar

这篇关于“在WebDriver.dll中发生类型为'System.InvalidOperationException'的未处理的异常".出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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