[iOS] Is there any way to perform a fast-click with duration is less than 200ms?

Hi guys,

I’m implementing some test scripts that will run from native iOS application then switch to safari then navigate back to native app again.
The key point is Appium couldn’t perform any actions if there are 2 applications are opened. (I can’t switch application since Appium hasn’t supported it yet)
So I find a workaround by clicking an element (in Safari) to navigating back to my native application.
I’ve tried tap/press (using opts). Unfortunately, it seems all Appium click-actions took more than 200ms or 500ms (I’m not sure).
Because of that problem, the element in the safari is always received a ‘long-press’.

Any idea on how to workaround/fix this?
Thanks in advance.

===========
Here is the log:
2016-01-09 21:55:49:937 - info: --> POST /wd/hub/session/43d84cb4-9e5f-46de-9c10-d0a7c5842078/touch/perform {“sessionId”:“43d84cb4-9e5f-46de-9c10-d0a7c5842078”,“actions”:[{“action”:“tap”,“options”:{“y”:505,“x”:180,“count”:2}},{“action”:“release”,“options”:{}}]}

2016-01-09 21:55:49:939 - info: [debug] Pushing command to appium work queue: “target.touch([{“touch”:[{“x”:180,“y”:505}],“time”:0.2}])”
2016-01-09 21:55:49:939 - info: [debug] Sending command to instruments: target.touch([{“touch”:[{“x”:180,“y”:505}],“time”:0.2}])

2016-01-09 21:55:50:389 - info: [debug] [INST] 2016-01-09 21:55:50 +0000 Debug: Got new command 3 from instruments: target.touch([{“touch”:[{“x”:180,“y”:505}],“time”:0.2}])

2016-01-09 21:55:50:390 - info: [debug] [INST] 2016-01-09 21:55:50 +0000 Debug: evaluating target.touch([{“touch”:[{“x”:180,“y”:505}],“time”:0.2}])

2016-01-09 21:55:50:392 - info: [debug] [INST] 2016-01-09 21:55:50 +0000 Debug: target.touch(__NSCFArray)

2016-01-09 21:55:51:460 - info: [debug] [INST] 2016-01-09 21:55:51 +0000 Debug: evaluation finished

Try

public static void tapOnPoint(IOSDriver driver, final PointOnScreen pointOnScreen) {
	driver.executeScript("mobile: tap", new HashMap<String, Double>() {{
		put("tapCount", 1.0);
		put("touchCount", 1.0);
		put("duration", 0.1);
		put("x", pointOnScreen.x);
		put("y", pointOnScreen.y);
	}});
}

/**

  • Created by sargisazaryan on 7/24/15.
    */
    public class PointOnScreen {
    public double x;
    public double y;

    public PointOnScreen (double x, double y) {
    this.x = x;
    this.y = y;
    }

    public double getX() {
    return this.x;
    }

    public double getY() {
    return this.y;
    }

    public PointOnScreen moveBy(int xOffset, int yOffset) {
    return new PointOnScreen(this.x + xOffset, this.y + yOffset);
    }

    public boolean equals(Object o) {
    if(!(o instanceof PointOnScreen)) {
    return false;
    } else {
    PointOnScreen other = (PointOnScreen)o;
    return other.x == this.x && other.y == this.y;
    }
    }

    public void move(int newX, int newY) {
    this.x = newX;
    this.y = newY;
    }

    public String toString() {
    return String.format("(%d, %d)", new Object[]{Double.valueOf(this.x), Double.valueOf(this.y)});
    }
    }