Hi Rajeenthini,

You are getting this exception because you can't cast the UESWebDriver into
HasInputDevices interface. That is because unlike other drivers such
as FirefoxDriver
and ChromeDriver the UESWebDriver only implements the WebDriver interface.

Therefore you need to implement the HasInputDevices interface in
UESWebDriver in order to use those mouse and keyboard actions.


Regards,

*Lasantha Samarakoon* | Software Engineer
WSO2, Inc.
#20, Palm Grove, Colombo 03, Sri Lanka
Mobile: +94 (71) 214 1576
Email:  [email protected]
Web:    www.wso2.com

lean . enterprise . middleware

On Thu, Oct 8, 2015 at 4:55 PM, Madusanka Premaratne <[email protected]>
wrote:

> Hi Rajinthini,
> It seems like you have to change the test case. Did you record the test
> case using selenium plugin? The best approach is write is yourself in this
> kind of scenarios. You can refer to the links[1] and [2] to get an idea.
> [1] -
> http://stackoverflow.com/questions/14210051/how-to-automate-drag-drop-functionality-using-selenium-web-driver
> [2] - http://www.toolsqa.com/selenium-webdriver/drag-drop/
>
> Thanks,
> Madusanka
>
> On Thu, Oct 8, 2015 at 3:48 PM, Rajeenthini Satkunam <[email protected]
> > wrote:
>
>> Hi All,
>>
>> I am currently working on writing UI test-cases using selenium for
>> Dashboard Server(DS)/User Engagement Server.I have a test Case which needs
>> to do a action that drag one element to a place and drop it in that
>> place(drag and drop).So I have tried the below approach to do this task.
>>
>> public void testAddGadgetToDashboard() throws Exception {
>>     webElement = getDriver().findElement(By.id(dashboardTitle));
>>     webElement.findElement(By.cssSelector("a[href=\"dashboards/" + 
>> dashboardTitle + "?editor=true\"]")).click();
>>     WebElement draggable = getDriver().findElement(By.id("g1"));
>>     WebElement to = getDriver().findElement(By.id("a"));
>>     Actions builder = new Actions(getDriver());
>>     Action dragAndDrop = builder.clickAndHold(draggable)
>>             .moveToElement(to)
>>             .release(to)
>>             .build();
>>     dragAndDrop.perform();
>>
>> }
>>
>> But I am getting an exception when running the test-case,
>>
>> FAILED: testAddGadgetToDashboard
>>         Adding gadgets to existing dashboard from dashboard server
>> java.lang.ClassCastException:
>> org.wso2.ues.ui.integration.util.UESWebDriver cannot be cast to
>> org.openqa.selenium.interactions.HasInputDevices
>> at org.openqa.selenium.interactions.Actions.<init>(Actions.java:41)
>> at
>> org.wso2.ues.ui.integration.test.dashboard.AddgadgetToDashboardtest.testAddGadgetToDashboard(AddgadgetToDashboardtest.java:86)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> at java.lang.reflect.Method.invoke(Method.java:601)
>> at
>> org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
>> at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
>> at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
>> at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
>> 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:767)
>> 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:52)
>> at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
>> at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
>> at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
>> at org.testng.TestNG.run(TestNG.java:1057)
>> at
>> org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:177)
>> at
>> org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
>> at
>> org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:105)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> at java.lang.reflect.Method.invoke(Method.java:601)
>> at
>> org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
>> at
>> org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
>> at
>> org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
>> at
>> org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103)
>> at
>> org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74)
>>
>> Can anyone please advice me on how this has gone wrong and Is selenium
>> version or Firefox version are depends on this error thrown?
>>
>> Note: I am using Firefox version 27 and selenium version is automation
>> selenium version.
>> --
>>
>> *Thank You.*
>>
>> *Rajeenthini Satkunam*
>>
>> *Associate Software Engineer | WSO2*
>>
>>
>> *E:[email protected] <[email protected]>*
>>
>> *M :+94770832823 <%2B94770832823>   *
>>
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> *Madusanka Premaratne* | Associate Software Engineer
> WSO2, Inc | lean. enterprise. middleware.
> #20, Palm Grove, Colombo 03, Sri Lanka
> Mobile: +94 71 835 70 73| Work: +94 112 145 345
> Email: [email protected] | Web: www.wso2.com
>
> [image: Facebook] <https://www.facebook.com/maduzanka> [image: Twitter]
> <https://twitter.com/rmmpremaratne> [image: Google Plus]
> <https://plus.google.com/u/0/+MadusankaPremaratnemaduz/about/p/pub> [image:
> Linkedin] <http://lk.linkedin.com/in/madusanka/> [image: Instagram]
> <http://instagram.com/madusankapremaratne> [image: Skype]
> <http://@rmmpremaratne>
>
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to