The error being reported says you were trying to cast a java.util.HashMap object to a String. So the raw object is a HashMap.
Is it possible that your Firefox is not installed in a standard location, so it can't find it?
Mike
On Tuesday, May 21, 2013 3:49:50 AM UTC-7, Daniel Brandi wrote:
Hi,
I am using RemoteWebDriver for some months and everything is working fine. But now I am triying to modify a property of FirefoxBinary. I am doing the following:
DesiredCapabilities capabilities = new DesiredCapabilities();
...
FirefoxBinary fb = new FirefoxBinary();
fb.setTimeout(java.util.concurrent.TimeUnit.SECONDS.toMillis(90));
capabilities.setCapability(FirefoxDriver.BINARY, fb);
driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"),capabilities);
It is not working. The problem seems to be in FirefoxDriver class where try to get the FirefoxBinary. It is doing this:
Object raw = capabilities.getCapability(BINARY);
if (raw instanceof FirefoxBinary) {
return (FirefoxBinary) raw;
}
File file = new File((String) raw);
But the instanceof is not returning TRUE and function tries to create a new file from object doing a cast to String. This is the error!!!!
What can I do to solve it? Any idea?
Thanks in advanced for your support.
Here you can find the trace log
[testng] FAILED CONFIGURATION: @BeforeTest startDriver
[testng] org.openqa.selenium.WebDriverException: java.util.HashMap cannot be cast to java.lang.String
[testng] Command duration or timeout: 195 milliseconds
[testng] Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:22:56'
[testng] System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_25'
[testng] Driver info: org.openqa.selenium.remote.RemoteWebDriver
[testng] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[testng] at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
[testng] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
[testng] at java.lang.reflect.Constructor.newInstance(Unknown Source)
[testng] at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:187)
[testng] at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
[testng] at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
[testng] at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
[testng] at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:111)
[testng] at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129)
[testng] at com.noticiasvideojuegos.Block1.startDriver(Block1.java:63)
[testng] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[testng] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[testng] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[testng] at java.lang.reflect.Method.invoke(Unknown Source)
[testng] at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
[testng] at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
[testng] at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
[testng] at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
[testng] at org.testng.TestRunner.beforeRun(TestRunner.java:641)
[testng] at org.testng.TestRunner.run(TestRunner.java:609)
[testng] at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
[testng] at org.testng.SuiteRunner.access$000(SuiteRunner.java:37)
[testng] at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:368)
[testng] at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
[testng] at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
[testng] at java.util.concurrent.FutureTask.run(Unknown Source)
[testng] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
[testng] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[testng] at java.lang.Thread.run(Unknown Source)
[testng] Caused by: java.lang.ClassCastException: java.util.HashMap cannot be cast to java.lang.String
[testng] at org.openqa.selenium.firefox.FirefoxDriver.getBinary(FirefoxDriver.java:172)
[testng] at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:100)
[testng] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[testng] at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
[testng] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
[testng] at java.lang.reflect.Constructor.newInstance(Unknown Source)
[testng] at org.openqa.selenium.remote.server.DefaultDriverFactory.callConstructor(DefaultDriverFactory.java:57)
[testng] at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:51)
[testng] at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:215)
[testng] at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)
[testng] at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
[testng] at java.util.concurrent.FutureTask.run(Unknown Source)
[testng] at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:169)
[testng] ... 3 more