Unable to run TouchAction Command in Appium for Android

Hi Everyone,

I have less experience in Appium.
I want to perform below mentioned action in my screen of emulator

1. Scroll down a little to get one button
2. Swipe left to find other button.

I have tried Touch Action Command, but they are not scrolling the `screen also its not getting failed. My scripts just gets end there, without performing any action.`

Commands I have tried:

1. action.press(427, 878).waitAction().moveTo(427, 
554).release().perform();
2. action.press(427, 878).moveTo(427, 554).release().perform();
  1.   Dimension size = wd.manage().window().getSize();
      int startx = size.getWidth() / 2;
      int starty = (int) (size.getHeight() * 0.8);
      int endy = (int) (size.getHeight() * 0.2);
     
     
      TouchAction action = new TouchAction(driver);
    

    action.press(startx,starty).waitAction().moveTo(startx,endy).release(
    ).perform();

    My System config is:

    1. Mac OS 10.13
    2. Android Emulator 6 and 7
    3. Gson 2.8.2
    4. Appium 1.7.2
    5. Standalone 3.9.1
    6. javaclinet 6.0.0 Beta3

Maybe try:

action.press(427, 878).waitAction(1000).moveTo(427,
554).release().perform();

The method waitAction(WaitOptions) in the type TouchAction is not applicable for the arguments (int)

This is error message I get when I write 1000 in waitAction()

Ohh I’m sorry i didn’t see you are using java-client 6. Then do it like this:

action.press(427, 878).waitAction(WaitOptions.waitOptions(Duration.ofMillis(1300)).moveTo(427,
554).release().perform();

…or event more correct should be:

action.press(PointOption.point(427, 878)).waitAction(WaitOptions.waitOptions(Duration.ofMillis(1300)).moveTo(PointOption.point(427, 554)).release().perform();

1 Like

Thank you so much buddy… it is working … :slight_smile: :slight_smile: :smile: :innocent:

You are welcome! :love_you_gesture: