How to perform triple tap on button in appium iOS

I am unable to perform triple tap in appium iOS.

I wan to tap a button 3 times frequently( within 2 secound).

Could you guys help me out here.

I am using Physical iOS device

Thanks in Advance

first: write what have you tried :-).

second: with UIAutomator was 1 sec delay on real device before commands. Not sure about XCTest.

also try:

new TouchAction((MobileDriver) driver).tap(element).tap(element).tap(element).perform();

el = driver.find_element …
action = TouchAction(driver)
action.tap(el, None, None, 3).perform()

I wanted to achieve the same on an element. I have tried below code but it says “Support for this gesture is not yet implemented. Please contact an Appium dev (WARNING: The server did not provide any stacktrace information)”

new IOSTouchAction(driver).Tap(ele).Tap(ele).Tap(ele).perform();

Appium: 1.6.3
JavaClient: 5.0.0-BETA5/4.1.2

did anyone achieved this, I am stuck at this step, actually this is the first step of my testcase.

@raghu_sairam try mine double but repeat just triple:

public boolean doubleTapElement(MobileElement element) {
        int x, y;
        try {
            x = element.getCenter().getX();
            y = element.getCenter().getY();
            new TouchAction((MobileDriver) driver).press(x,y).waitAction(50).release().perform();
            //((AppiumDriver) driver).tap(1, x, y, 100);
            try {
                Thread.sleep(50);
            } catch (Exception e1) {
            }
            new TouchAction((MobileDriver) driver).press(x,y).waitAction(50).release().perform();
            //((AppiumDriver) driver).tap(1, x, y, 100);
            return true;
        } catch (Exception e) {
            return false;
        }
    }

or something like

// instead x,y you can use also some element.
new TouchAction((MobileDriver) driver).press(x,y).waitAction(50).release().press(x,y).waitAction(50).release().press(x,y).waitAction(50).release().perform();

@Aleksei, took your coded and played around by replacing press method with tap method. Repeated the new TouchAction line three times but no use :disappointed:. I don’t know what I am missing.

	public static boolean doubleTapElement(MobileElement element) {
    int x,y;
	try {
    	x = element.getCenter().getX();
        y = element.getCenter().getY();
        new TouchAction((MobileDriver) driver).press(x,y).waitAction(50).release().press(x,y).waitAction(50).release().press(x,y).waitAction(50).release().perform();
        //((AppiumDriver) driver).tap(1, x, y, 100);
        try {
            
        } catch (Exception e1) {
        }
        new TouchAction((MobileDriver) driver).press(x,y).waitAction(50).release().press(x,y).waitAction(50).release().press(x,y).waitAction(50).release().perform();
        //((AppiumDriver) driver).tap(1, x, y, 100);
        try {
            
        } catch (Exception e1) {
        }
        new TouchAction((MobileDriver) driver).press(x,y).waitAction(50).release().press(x,y).waitAction(50).release().press(x,y).waitAction(50).release().perform();            
        return true;
    } catch (Exception e) {
        return false;
    }
}

Appium: 1.6.3
JavaClient: 5.0.0-BETA5/4.1.2

what does it mean?

what happen when you tap? you can log and see if it fast for 2sec to complete.

tried replacing “press” method with “tap” method, below is the code and I repeated couple of times to make it triple tap on an element.

new TouchAction((MobileDriver) driver).tap(element).perform();

little history with my problem, I was able to achieve triple tap with appium 1.5 by using below code.

		MobileElement row = (MobileElement) driver.findElement(By.name("LOGIN"));
		JavascriptExecutor js = (JavascriptExecutor) driver;
		HashMap<String, Object> tapObject = new HashMap<String, Object>();

		double x = row.getLocation().x;
		double y = row.getLocation().y;

		tapObject.put("x", x); // in pixels from left
		tapObject.put("y", y); // in pixels from top
		tapObject.put("duration", 0.0);
		tapObject.put("touchCount", 1.0);
		tapObject.put("tapCount", 3.0); // triple tap
		js.executeScript("mobile: tap", tapObject);

but when I migrated to appium 1.6, then problem started, the above code didn’t worked and shown not yet implemented exception. And I’m stuck as I mentioned this is my first test step.

did you try press method i suggest?

Yes I tried but no luck for my case.

did you check what problem is? is pressing into wrong place OR too slow to fit into 2 sec? The last case you will not fix.

try also with latest 1.6.4-beta.

My case here to achieve triple tap in less than seconds (which will enable some other options in my app). So my last resort is to try 1.6.4-beta :disappointed:

you will not get 1sec - 100%. tried with Simulator. with real device believe slower.

Simulator (i7 core macPro):

1)
Long startTime = System.currentTimeMillis();
new TouchAction((MobileDriver) driver).press(x,y).waitAction(50).release().perform();
System.out.println("   done in: " + (System.currentTimeMillis() - startTime) + " msec");
new TouchAction((MobileDriver) driver).press(x,y).waitAction(50).release().perform();
System.out.println("   done in: " + (System.currentTimeMillis() - startTime) + " msec");
new TouchAction((MobileDriver) driver).press(x,y).waitAction(50).release().perform();
System.out.println("   done in: " + (System.currentTimeMillis() - startTime) + " msec");

->

done in: 484 msec
done in: 2020 msec
done in: 2772 msec

2)
Long startTime = System.currentTimeMillis();
new TouchAction((MobileDriver) driver).press(element).waitAction(50).release().perform();
System.out.println("   done in: " + (System.currentTimeMillis() - startTime) + " msec");
new TouchAction((MobileDriver) driver).press(element).waitAction(50).release().perform();
System.out.println("   done in: " + (System.currentTimeMillis() - startTime) + " msec");
new TouchAction((MobileDriver) driver).press(element).waitAction(50).release().perform();
System.out.println("   done in: " + (System.currentTimeMillis() - startTime) + " msec");

->

done in: 912 msec
done in: 2619 msec
done in: 3188 msec

3)
Long startTime = System.currentTimeMillis();
new TouchAction((MobileDriver) driver).tap(x,y).perform();
System.out.println("   done in: " + (System.currentTimeMillis() - startTime) + " msec");
new TouchAction((MobileDriver) driver).tap(x,y).perform();
System.out.println("   done in: " + (System.currentTimeMillis() - startTime) + " msec");
new TouchAction((MobileDriver) driver).tap(x,y).perform();
System.out.println("   done in: " + (System.currentTimeMillis() - startTime) + " msec");

->

done in: 954 msec
done in: 2634 msec
done in: 3535 msec

Hi All,

Please help me out on triple tab on iOS 10.2 using appium 1.6.4 beta 4 version.
Java Client :5.0 beta 6
Selenium : 3.1

We are try to tap 3 times in one slot on a element to get a window.
But it is not happening in one slot. I will really appreciate if you guys help me out from this situation.

Regards
SS