Single Tap event is showing the class cast exception with Iphone Driver

797 views
Skip to first unread message

Mani

unread,
May 1, 2012, 3:09:53 PM5/1/12
to webd...@googlegroups.com
Hello

when i an using this code .

@Test(enabled=true)
    public void testsingleTapOnElement() {
            WebElement toSingleTap = webDriver.findElement(By.xpath("//span[text()='Data']"));
           
            Action singleTap = getBuilder(webDriver).singleTap(toSingleTap).build();
            singleTap.perform();
          }

     private TouchActions getBuilder(WebDriver driver) {
            return new TouchActions(driver);
          }

Its showing me this error . Can i use the touch event web iwebdriver.

Thanks
Adity

java.lang.ClassCastException: org.openqa.selenium.iphone.IPhoneDriver cannot be cast to org.openqa.selenium.HasTouchScreen
    at org.openqa.selenium.interactions.touch.TouchActions.<init>(TouchActions.java:38)
    at com.proferi.qe.uitest.XpathTest.getBuilder(XpathTest.java:82)
    at com.proferi.qe.uitest.XpathTest.testsingleTapOnElement(XpathTest.java:77)
    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)

Luke Inman-Semerau

unread,
May 1, 2012, 3:39:19 PM5/1/12
to webd...@googlegroups.com
touch events have not been implemented yet in iWebDriver, only AndroidDriver currently supports them.


--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/YgG9pidkvBAJ.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.

Mani

unread,
May 1, 2012, 3:59:30 PM5/1/12
to webd...@googlegroups.com
ok. Thanks , AS iphone webdriver 's click is not working is there any other way to simulate that operation.

Thanks for help.
To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.

Luke Inman-Semerau

unread,
May 1, 2012, 4:27:14 PM5/1/12
to webd...@googlegroups.com
Does your webpage use a Javascript library? (hopefully)

If it's loading jQuery you can do something like this:
((JavascripExecutor)webDriver).executeScript("$(arguments[0]).click();", toSingleTap);

otherwise if you're page is using a different JS library you should use that (ask a UI dev on the team)

To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/1yt0dRgWwSMJ.

To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.

Pavithra

unread,
Aug 21, 2012, 8:07:42 AM8/21/12
to webd...@googlegroups.com
Mani,
Did you got any solution for above ?

Thanks,
Pavithra

Pavithra

unread,
Sep 5, 2012, 4:54:46 AM9/5/12
to webd...@googlegroups.com
I am getting this same error even using Android driver.
Do I need to do something else to achieve this?

Thanks,
Pavithra

Mohit kumar

unread,
Jul 18, 2013, 8:30:05 AM7/18/13
to webd...@googlegroups.com
Hi,

I am getting same error while using ios driver for ipad.
Can you paste java script for singleTap? And code example.

Reply all
Reply to author
Forward
0 new messages