"An unhandled exception of type 'System.InvalidOperationException' occurred in WebDriver.dll" error coming up
Asked Answered
D

1

0

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

Getting the error exception as:

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. I am running a selenium grid as role=hub, with localhost:4444 as the port.
  2. Have added the PATH environment variable in System properties as "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
  3. I have also tried downgrading the selenium jars versions and even browser versions but no result.

Can anyone please tell how to fix this?

What would be the correct code to fix this issue?

Denney answered 11/2, 2017 at 19:45 Comment(1)
Possible duplicate of stackoverflow.com/questions/34217563. Also, this link might help, too: github.com/angular/protractor/issues/1226#issuecomment-53930736Geographical
H
1

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

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.

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

Hambletonian answered 12/2, 2017 at 12:3 Comment(1)
I just did a small tweak. 1). I launched the command prompt in "admin mode". 2). Gave the java path as "cd C:\Program Files (x86)\Java" in it 3). Then ran the command as "java -jar selenium-server-standalone-3.0.1.jar" without specifying any role and Vollaaaa...it got fixed...!!! Thanks to all of you for your help...Was after this error for last 3 days...a great relief I must say.. :-)Denney

© 2022 - 2024 — McMap. All rights reserved.