Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

I am newbie with selenium and writing selenium test cases, I am basically trying to modify existing code in order to enhance some functionality.

I am creating a webDriver using the following code :

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("key", true);
    capabilities.setCapability("key", "value");
    if (driverUrl != null) {
        System.out.println(" Capabilities are "+capabilities.toString());
        try {
            URL url = new URL(driverUrl);
            System.out.println(" DriverUtil: createDriver() path: "+url.toString()+" protocol "+url.getProtocol()+" hostName :"+url.getHost()+" port "+url.getPort());
            WebDriver driver = new RemoteWebDriver(url, capabilities);
            System.out.println(" WebDriver is "+driver);
            return driver;
        } catch (MalformedURLException e) {
            throw new IllegalStateException("Failed to create remote web driver for url " + driverUrl, e);

The url as well as the capabilities have the following values :

 DriverUtil webDriver is http://xyz-qaa.abc.no
 Capabilities are Capabilities [{browserName=firefox, key=value}]

I have modified the url in this question but as such the url has a valid value and can be opened in the browser.

But when I try to run the test cases I see this :

 Caused by:
        java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map
            at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:218)
            at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:111)
            at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129)
            at heimdall.ui.webtest.DriverUtil.createDriver(DriverUtil.java:46)

I have looked around to find a solution for this but I am unable to find one. Any suggestions?

I am not entirely sure which version of selenium is being used, because I am not the original author, but in te eclipse project I did find that the org.seleniumhq.selenium/selenium-remote-driver/2.32.0.jar and selenium-firefox-driver-2.32.0.jar is being used.

share|improve this question
Which version of Selenium? –  user246 Nov 16 '13 at 21:27
@user246 updating the question with more information –  bhavs Nov 18 '13 at 7:54
The latest version of Selenium is 2.37. Do you have the same problem in that release? Also, what is the purpose of these two lines: capabilities.setCapability("key", true); capabilities.setCapability("key", "value"); –  user246 Nov 19 '13 at 0:12
@user246 I am using those lines to set some dummy values, I have as such no requirement of those lines, but I just verified that even after I remove those lines I stil seem to be facing the above issue –  bhavs Nov 19 '13 at 4:14
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.