FirefoxDriver cannot be cast to org.openqa.selenium.html5.WebStorage

1,292 views
Skip to first unread message

raghavendra kumar

unread,
Aug 27, 2012, 3:22:48 AM8/27/12
to seleniu...@googlegroups.com
When  I am using the Selenium HTML5 api methods in  my script,I am getting the below exception.

Please provide me a solution for this problem.

org.openqa.selenium.WebDriverException: org.openqa.selenium.firefox.FirefoxDriver cannot be cast to org.openqa.selenium.html5.WebStorage
Command duration or timeout: 16 milliseconds
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:09:54'
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_13'
Driver info: driver.version: RemoteWebDriver
Session ID: 1346051833955
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:188)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:498)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:502)
at org.openqa.selenium.remote.RemoteExecuteMethod.execute(RemoteExecuteMethod.java:32)
at org.openqa.selenium.remote.html5.RemoteLocalStorage.size(RemoteLocalStorage.java:65)
at LoginTestClass.loginTest(LoginTestClass.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:702)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:894)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1219)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:768)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:87)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
at org.testng.TestNG.run(TestNG.java:1022)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:109)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)
Caused by: java.lang.ClassCastException: org.openqa.selenium.firefox.FirefoxDriver cannot be cast to org.openqa.selenium.html5.WebStorage
at org.openqa.selenium.remote.server.handler.html5.GetLocalStorageSize.call(GetLocalStorageSize.java:31)
at org.openqa.selenium.remote.server.handler.html5.GetLocalStorageSize.call(GetLocalStorageSize.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:150)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


--
Raghavendra Kumar

Krishnan Mahadevan

unread,
Aug 27, 2012, 3:23:52 AM8/27/12
to seleniu...@googlegroups.com
Can you please include the source code that triggered this exception ?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ashish Juyal

unread,
Aug 27, 2012, 3:28:41 AM8/27/12
to seleniu...@googlegroups.com

Hi 
    I am trying to click a div ,here's the code
<td class="ui-pg-button ui-corner-all" title="Delete Item"><div class="ui-pg-div"><span class="ui-icon ui-icon-trash"></span>Delete</div></td>
I failed to click the div.

Here my code

WebElement elements =driver.findElement(By.xpath("//*[@id='ItemMasterPager_left']/table/tbody/tr/td[1]/div[contains(text(),'Delete')]"));
       
        
       
        Actions moveTo = new Actions(driver);
        moveTo.moveToElement(elements).click().build().perform();


Any help will be appreciated


Thanks in advance 
Ashish Juyal

Krishnan Mahadevan

unread,
Aug 27, 2012, 3:33:44 AM8/27/12
to seleniu...@googlegroups.com
Ashish,
Please DONOT cross post on threads which are NOT related to your question.

I believe you have already posted your query here : https://groups.google.com/d/topic/selenium-users/ahieOQxK6Jo/discussion

Please be patient, while someone helps you with an answer !

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



raghavendra kumar

unread,
Aug 27, 2012, 3:55:16 AM8/27/12
to seleniu...@googlegroups.com
DesiredCapabilities capabilities =DesiredCapabilities.chrome();
capabilities.setBrowserName("chrome");
RemoteWebDriver driver =new RemoteWebDriver(new URL("http://127.0.0.1:4444/wd/hub"),capabilities);
ExecuteMethod executeMethod =new RemoteExecuteMethod(driver);
RemoteLocalStorage lstorage =new RemoteLocalStorage(executeMethod);
driver.manage().window().maximize();
driver.findElement(By.name("uname")).sendKeys("a");
driver.findElement(By.xpath("//input[@type='password']")).sendKeys("a");
driver.findElement(By.xpath("//input[@class='submit_btn']")).click();
lstorage.setItem("tester", "testing");

On Mon, Aug 27, 2012 at 12:53 PM, Krishnan Mahadevan <krishnan.ma...@gmail.com> wrote:

Krishnan Mahadevan

unread,
Aug 27, 2012, 4:18:59 AM8/27/12
to seleniu...@googlegroups.com
I haven't worked with RemoteLocalStorage till now, but from the exception, am guessing you are doing something that shouldn't be done.

In your sample code, I dont see you do anything with the lstorage instance. What happens when you remove references to it, and instead work with the html5 elements as if they were regular elements ?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



Reply all
Reply to author
Forward
0 new messages