# Touch Actions and Mobile Web

**URL:** <https://discuss.appium.io/t/touch-actions-and-mobile-web/795>\
**Category:** Support\
**Created:** [October 9, 2014, 5:40pm UTC](https://discuss.appium.io/t/touch-actions-and-mobile-web/795 "2014-10-09T17:40:52Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![SergeyTichomirov](https://discuss.appium.io/user_avatar/discuss.appium.io/sergeytichomirov/32/5175_2.png) [@SergeyTichomirov](https://discuss.appium.io/u/SergeyTichomirov)\
**Post date:** [November 7, 2014, 10:02am UTC](https://discuss.appium.io/t/touch-actions-and-mobile-web/795/21 "2014-11-07T10:02:49Z")

</div>

It seems it has been fixed here:

> <https://github.com/appium/appium/issues/3960>
>
> Swipe on webview elements \_can\_ work. Right now we assume it doesn't work at all…, and \[block touch actions when in a webview context\](https://github.com/appium/appium/blob/c37736faef33aedaaaedbb2a30d51ac7cf9503e1/lib/server/controller.js#L307-L309).
> 
> It works fine on iOS and breaks on android. All that needs to be done to fix it on Android is to have \`find\` commands go to the current context as usual, but have swipe actions sent to appium instead of being proxied to chromedriver.

and now is going with the new release.  
Also, with the new server release [this java client feature](https://github.com/appium/java-client/pull/130) is going to be published.

---

<div class="post-metadata">

**Author:** ![maxski](https://discuss.appium.io/letter_avatar_proxy/v4/letter/m/8491ac/32.png) [@maxski](https://discuss.appium.io/u/maxski)\
**Post date:** [November 7, 2014, 12:13pm UTC](https://discuss.appium.io/t/touch-actions-and-mobile-web/795/22 "2014-11-07T12:13:03Z")

</div>

Waiting for the 1.3.2 ☀

---

<div class="post-metadata">

**Author:** ![jonahss](https://discuss.appium.io/user_avatar/discuss.appium.io/jonahss/32/5340_2.png) [@jonahss](https://discuss.appium.io/u/jonahss)\
**Post date:** [November 11, 2014, 9:35pm UTC](https://discuss.appium.io/t/touch-actions-and-mobile-web/795/23 "2014-11-11T21:35:40Z")

</div>

It’s coming! 😃  
Running tests as we speak.

---

<div class="post-metadata">

**Author:** ![maxski](https://discuss.appium.io/letter_avatar_proxy/v4/letter/m/8491ac/32.png) [@maxski](https://discuss.appium.io/u/maxski)\
**Post date:** [November 17, 2014, 12:06pm UTC](https://discuss.appium.io/t/touch-actions-and-mobile-web/795/24 "2014-11-17T12:06:33Z")

</div>

Hey, @jonahss, @SergeyTichomirov

Looks, this is no longer valid in 1.3.2:  
executeScript(“mobile: swipe”, swipeObject)

Is there a way to tap, swipe and scrollTo element in webview?

---

<div class="post-metadata">

**Author:** ![SergeyTichomirov](https://discuss.appium.io/user_avatar/discuss.appium.io/sergeytichomirov/32/5175_2.png) [@SergeyTichomirov](https://discuss.appium.io/u/SergeyTichomirov)\
**Post date:** [November 17, 2014, 12:19pm UTC](https://discuss.appium.io/t/touch-actions-and-mobile-web/795/25 "2014-11-17T12:19:26Z")

</div>

Does it not work?  
Have you tried

> element.tap()  
> element.zoom()  
> element.pinch()  
> element.swipe(direction, int)

?

---

<div class="post-metadata">

**Author:** ![SergeyTichomirov](https://discuss.appium.io/user_avatar/discuss.appium.io/sergeytichomirov/32/5175_2.png) [@SergeyTichomirov](https://discuss.appium.io/u/SergeyTichomirov)\
**Post date:** [November 17, 2014, 12:21pm UTC](https://discuss.appium.io/t/touch-actions-and-mobile-web/795/26 "2014-11-17T12:21:02Z")

</div>

It something weird if it doesn’t work

> executeScript(“mobile: swipe”, swipeObject);

Maybe something is broken on the server-side…

---

<div class="post-metadata">

**Author:** ![maxski](https://discuss.appium.io/letter_avatar_proxy/v4/letter/m/8491ac/32.png) [@maxski](https://discuss.appium.io/u/maxski)\
**Post date:** [November 17, 2014, 12:27pm UTC](https://discuss.appium.io/t/touch-actions-and-mobile-web/795/27 "2014-11-17T12:27:06Z")

</div>

Regarding the last one I’m not sure if it still needed if above will works.  
But I got the following:

> e[36minfoe[39m: e[37m–\>e[39m e[37mPOSTe[39m e[37m/wd/hub/session/cde2565af9101509c4316c499667ac90/executee[39m e[90m{“script”:“mobile: swipe”,“args”:[{“startX”:0.5,“duration”:2,“startY”:0.6,“endX”:0.5,“endY”:0.2}]}e[39m  
> e[36minfoe[39m: [debug] Tried to execute non-existent mobile command ‘swipe’. Most mobile commands have been ported to official client library methods. Please check your Appium library for more information and documentation  
> e[36minfoe[39m: [debug] Responding to client that a method is not implemented

Let me get out the error message for trying touch actions for web, like element.tap()

---

<div class="post-metadata">

**Author:** ![maxski](https://discuss.appium.io/letter_avatar_proxy/v4/letter/m/8491ac/32.png) [@maxski](https://discuss.appium.io/u/maxski)\
**Post date:** [November 17, 2014, 12:33pm UTC](https://discuss.appium.io/t/touch-actions-and-mobile-web/795/28 "2014-11-17T12:33:11Z")

</div>

public LobbyPage(AppiumSwipeableDriver driver, String game) {  
this.driver = driver;  
this.game = game;  
PageFactory.initElements(new AppiumFieldDecorator(driver), this);  
}

@FindBy(xpath = “//img[contains(@src, ‘image’)]”)  
public MobileElement casinoTab;

And the next one is failed with:  
casinoTab.tap(1,1);

java.lang.IllegalArgumentException: object is not an instance of declaring class  
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:606)  
at io.appium.java\_client.pagefactory.ElementInterceptor.intercept(ElementInterceptor.java:27)  
at io.appium.java\_client.MobileElement$$EnhancerByCGLIB$$50f36ea9.tap()  
at com.pages.LobbyPage.openCasinoTab(LobbyPage.java:67)  
at com.pages.LobbyPage.openGameWithLogin(LobbyPage.java:87)  
at com.run.ScreenshotMaker.gameActions(ScreenshotMaker.java:81)  
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:606)  
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:348)  
at org.testng.SuiteRunner.access$000(SuiteRunner.java:38)  
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:382)  
at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)  
at java.util.concurrent.FutureTask.run(FutureTask.java:262)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
at java.lang.Thread.run(Thread.java:745)

---

<div class="post-metadata">

**Author:** ![SergeyTichomirov](https://discuss.appium.io/user_avatar/discuss.appium.io/sergeytichomirov/32/5175_2.png) [@SergeyTichomirov](https://discuss.appium.io/u/SergeyTichomirov)\
**Post date:** [November 17, 2014, 12:47pm UTC](https://discuss.appium.io/t/touch-actions-and-mobile-web/795/29 "2014-11-17T12:47:31Z")

</div>

I am investigating…

---

<div class="post-metadata">

**Author:** ![SergeyTichomirov](https://discuss.appium.io/user_avatar/discuss.appium.io/sergeytichomirov/32/5175_2.png) [@SergeyTichomirov](https://discuss.appium.io/u/SergeyTichomirov)\
**Post date:** [November 17, 2014, 1:31pm UTC](https://discuss.appium.io/t/touch-actions-and-mobile-web/795/30 "2014-11-17T13:31:22Z")

</div>

> [@maxski](#):
>
> java.lang.IllegalArgumentException: object is not an instance of declaring class

Is AppiumSwipeableDriver a RemoteWebDriver (not AndroidDriver/IOSDriver) subclass?

---

<div class="post-metadata">

**Author:** ![maxski](https://discuss.appium.io/letter_avatar_proxy/v4/letter/m/8491ac/32.png) [@maxski](https://discuss.appium.io/u/maxski)\
**Post date:** [November 17, 2014, 1:36pm UTC](https://discuss.appium.io/t/touch-actions-and-mobile-web/795/31 "2014-11-17T13:36:12Z")

</div>

It’s a subclass from AppiumDriver

---

<div class="post-metadata">

**Author:** ![SergeyTichomirov](https://discuss.appium.io/user_avatar/discuss.appium.io/sergeytichomirov/32/5175_2.png) [@SergeyTichomirov](https://discuss.appium.io/u/SergeyTichomirov)\
**Post date:** [November 17, 2014, 1:49pm UTC](https://discuss.appium.io/t/touch-actions-and-mobile-web/795/32 "2014-11-17T13:49:28Z")

</div>

Ok. Now it is clear for me.

AppiumDriver is abstract class since 2.0.0 (java-client version). It is extended by AndroidDriver and IOSDriver. AndoidDriver generates AndroidElements and IOSDriver generates IOSElements. Both AndroidElement and IOSElement extend MobileElement.

AndroidDriver and IOSDriver have specific JsonToWebElementConverters. AppiumDriver has’t any specific converter. In your case it works like RemoteWebDriver and you receive RemoteWebElement. It is the root cause of your problem.

Why you are using AppiumSwipeableDriver (customized AppiumDriver)?

---

<div class="post-metadata">

**Author:** ![maxski](https://discuss.appium.io/letter_avatar_proxy/v4/letter/m/8491ac/32.png) [@maxski](https://discuss.appium.io/u/maxski)\
**Post date:** [November 17, 2014, 2:20pm UTC](https://discuss.appium.io/t/touch-actions-and-mobile-web/795/33 "2014-11-17T14:20:41Z")

</div>

Let me check AndroidDriver

Hmm, seems I got another error:  
Not yet implemented. Please help us: [http://appium.io/get-involved.html](http://appium.io/get-involved.html) (WARNING: The server did not provide any stacktrace information)  
Command duration or timeout: 4 milliseconds  
java.lang.reflect.InvocationTargetException  
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:606)  
at io.appium.java\_client.pagefactory.ElementInterceptor.intercept(ElementInterceptor.java:27)  
at io.appium.java\_client.MobileElement$$EnhancerByCGLIB$$4ecee8af.tap()  
at com.pages.LobbyPage.openCasinoTab(LobbyPage.java:64)  
at com.pages.LobbyPage.openGameWithLogin(LobbyPage.java:84)  
at com.run.ScreenshotMaker.gameActions(ScreenshotMaker.java:81)  
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:606)  
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:348)  
at org.testng.SuiteRunner.access$000(SuiteRunner.java:38)  
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:382)  
at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)  
at java.util.concurrent.FutureTask.run(FutureTask.java:262)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
at java.lang.Thread.run(Thread.java:745)

This error was the cause why I was using Custom AppiumDriver with HasTouchScreen interface

---

<div class="post-metadata">

**Author:** ![SergeyTichomirov](https://discuss.appium.io/user_avatar/discuss.appium.io/sergeytichomirov/32/5175_2.png) [@SergeyTichomirov](https://discuss.appium.io/u/SergeyTichomirov)\
**Post date:** [November 17, 2014, 2:57pm UTC](https://discuss.appium.io/t/touch-actions-and-mobile-web/795/34 "2014-11-17T14:57:43Z")

</div>

Ok. Now I need help too. ☹  
It seems that something wrong with chromedriver. I have got something similar. Android 4.4.4. I caught this error before, but I seems that problem is still here.

> Caused by: org.openqa.selenium.UnsupportedCommandException: unknown command: session/0b2b54337ca29e828a1234450ec437ec/touch/perform  
> Command duration or timeout: 21 milliseconds  
> Build info: version: ‘2.43.1’, revision: ‘5163bceef1bc36d43f3dc0b83c88998168a363a0’, time: ‘2014-09-10 09:43:55’  
> System info: host: ‘xxx’, ip: ‘xxxx’, os.name: ‘Windows 7’, os.arch: ‘amd64’, os.version: ‘6.1’, java.version: ‘1.8.0\_20’  
> Driver info: io.appium.java\_client.android.AndroidDriver  
> Capabilities [{app=xxxx, networkConnectionEnabled=true, warnings={}, databaseEnabled=false, deviceName=Android Emulator, platform=LINUX, desired={app=xxx, platformName=Android, deviceName=Android Emulator}, platformVersion=4.4.4, webStorageEnabled=false, locationContextEnabled=false, browserName=Android, takesScreenshot=true, javascriptEnabled=true, platformName=Android}]  
> Session ID: 3603990e-67e6-49df-81dc-304f1b49bdfa  
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)  
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)  
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)  
> at java.lang.reflect.Constructor.newInstance(Unknown Source)  
> at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)  
> at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)  
> at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)  
> at io.appium.java\_client.AppiumDriver.execute(AppiumDriver.java:180)  
> at io.appium.java\_client.AppiumDriver.performTouchAction(AppiumDriver.java:304)  
> at io.appium.java\_client.MultiTouchAction.perform(MultiTouchAction.java:74)  
> at io.appium.java\_client.AppiumDriver.tap(AppiumDriver.java:331)  
> at io.appium.java\_client.MobileElement.tap(MobileElement.java:71)  
> at io.appium.java\_client.MobileElement$$FastClassBySpringCGLIB$$f90deb4e.invoke()  
> at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)

Actually today is the first time I use appium 1.3.2 beta.

@jonahss

Do you have any idea? It happens when driver is switched to WEBVIEV and chromedriver is started. I attempted to perform tap()

---

<div class="post-metadata">

**Author:** ![SergeyTichomirov](https://discuss.appium.io/user_avatar/discuss.appium.io/sergeytichomirov/32/5175_2.png) [@SergeyTichomirov](https://discuss.appium.io/u/SergeyTichomirov)\
**Post date:** [November 19, 2014, 9:19am UTC](https://discuss.appium.io/t/touch-actions-and-mobile-web/795/35 "2014-11-19T09:19:59Z")

</div>

It seems that it works for iOS. But it is still invalid for Android ☹

It is supposed that there are fixes:

> <https://github.com/appium/appium/pull/4005>

> <https://github.com/appium/appium/issues/4075>
>
> Related to https://github.com/appium/appium/pull/4005.
> 
> Workaround is deriving x….y coordinates from WV element and then passing them to the native context.

---

<div class="post-metadata">

**Author:** ![vibro](https://discuss.appium.io/user_avatar/discuss.appium.io/vibro/32/5289_2.png) [@vibro](https://discuss.appium.io/u/vibro)\
**Post date:** [November 20, 2014, 3:30pm UTC](https://discuss.appium.io/t/touch-actions-and-mobile-web/795/36 "2014-11-20T15:30:11Z")

</div>

I just tried using the iPad 8.1 simulator with the exact same code that works on iPad 6.1 simulator and I’m getting an error while executing a TouchAction, driver.tap(). The error is a WebDriverException, error occurred while executing JavaScript

Am I doing something wrong here?

---

<div class="post-metadata">

**Author:** ![iammerrick](https://discuss.appium.io/user_avatar/discuss.appium.io/iammerrick/32/991_2.png) [@iammerrick](https://discuss.appium.io/u/iammerrick)\
**Post date:** [May 18, 2015, 10:14pm UTC](https://discuss.appium.io/t/touch-actions-and-mobile-web/795/37 "2015-05-18T22:14:24Z")

</div>

Anyone able to use touch actions in iOS 8? Not seeing touchstart events firing with .tap() so went to try TouchAction to no avail…

---

<div class="post-metadata">

**Author:** ![Ricardonacif](https://discuss.appium.io/letter_avatar_proxy/v4/letter/r/f1d935/32.png) [@Ricardonacif](https://discuss.appium.io/u/Ricardonacif)\
**Post date:** [May 20, 2015, 7:49pm UTC](https://discuss.appium.io/t/touch-actions-and-mobile-web/795/38 "2015-05-20T19:49:45Z")

</div>

For those using Ruby, I have developed a gem that solves the situation: [https://github.com/Ricardonacif/touch\_action](https://github.com/Ricardonacif/touch_action)

---

<div class="post-metadata">

**Author:** ![Rameshwar\_Juptimath](https://discuss.appium.io/letter_avatar_proxy/v4/letter/r/9d8465/32.png) [@Rameshwar\_Juptimath](https://discuss.appium.io/u/Rameshwar_Juptimath)\
**Post date:** [September 1, 2015, 9:50am UTC](https://discuss.appium.io/t/touch-actions-and-mobile-web/795/39 "2015-09-01T09:50:01Z")

</div>

Does anyone know if there is any work around for this issue on dot-net driver.

Because dot-net driver does not have tap method.

---

<div class="post-metadata">

**Author:** ![nesa246](https://discuss.appium.io/user_avatar/discuss.appium.io/nesa246/32/1360_2.png) [@nesa246](https://discuss.appium.io/u/nesa246)\
**Post date:** [March 18, 2016, 7:11am UTC](https://discuss.appium.io/t/touch-actions-and-mobile-web/795/40 "2016-03-18T07:11:55Z")

</div>

Current DotNetDriver is having tap method,

AppiumDriver driver = GetDriver(); // TODO Using user and capabilities.

driver.Tap(1, X, Y, 10);  
driver.Tap(NoOfFingers, Xaxis, Yaxis, howLongNeedToPress);

I have tested in IOS Safari Real device, its working without issues, but before doing the tap, make sure you switch the Context to NATIVE\_APP while doing the tap and after tap switch back to web View

[Previous page](https://discuss.appium.io/t/touch-actions-and-mobile-web/795.md?page=1)

[Next page](https://discuss.appium.io/t/touch-actions-and-mobile-web/795.md?page=3)
