user3380476
user3380476

Reputation: 21

Exception on Selenium Grid program

Have started the hub and registered the node. Then wrote a program in eclipse:

after running the program i am getting below exception:- Exception in thread "main" java. lang.Class Cast Exception: java.lang.String cannot be cast to java.util.Map.

the remote web driver is :

Remote Web Driver driver = new Remote Web Driver(client URL,capability);

Upvotes: 2

Views: 1275

Answers (1)

Sergii Tanchenko
Sergii Tanchenko

Reputation: 721

I've had the same error. The problem was in class org.openqa.selenium.remote.RemoteWebDriver (75):

Map<String, Object> rawCapabilities = (Map<String, Object>) response.getValue();

It's happened because I've given the wrong URL parameter for RemoteWebDriver():

WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/"), capability);

That's why response had a String type. Please check your url. It should be:

WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);

I hope it will help you :)

Upvotes: 4

Related Questions