[iOS] How to write "flick" function in Java

293 views
Skip to first unread message

Anson Liao

unread,
Mar 28, 2014, 1:49:11 AM3/28/14
to appium-...@googlegroups.com
Dear All,
As a new Appiummer and some function don't know how to code in Java.

I would like to the Flick function and how to code a swipe gesture in iOS app.

I refer to Appium sample code in Java, and found the simplest code is "flick(0, -20)".

I check flick api in Selenium website, and found that:
xSpeed - The horizontal speed in pixels/second
ySpeed - The vertical speed in pixels/second

so, ySpeed = -20, what it means?

and I would like to implement a swipe gesture in Appium of Java, the swipe is from right to left to switch to "Next" page, my some trying java code as below, but it nothing happen the Java script run.

TouchActions swipe = new TouchActions(wd).flick(-200, 0); TouchActions swipe = new TouchActions(wd).flick(200, 0);

How I should code in Flick function?

and if need to swipe by two finger touch point, how I can code in Java?

Thanks.





Anson Liao

unread,
Mar 31, 2014, 10:22:06 PM3/31/14
to appium-...@googlegroups.com
Anyone can help me on this?

pittsd

unread,
Apr 9, 2014, 6:01:56 AM4/9/14
to appium-...@googlegroups.com
You have to call a perform after the flick e.g.

public void swipeToLeft() {

TouchActions flick = new TouchActions(driver).flick(page, -100, 0, 0);

flick.perform();

}

I usually swipe on a webelement though - don't really remember why

Anson Liao

unread,
Apr 10, 2014, 5:39:03 AM4/10/14
to appium-...@googlegroups.com
Yes, sir, I wrote the perform code, but nothing happen.

pittsd

unread,
Apr 10, 2014, 5:59:39 AM4/10/14
to appium-...@googlegroups.com
Not sure. Try and debug by:
1. Changing the webelement you are swiping
2. Enter different values for the x y coordinates and speed
3. Make sure you can swipe on device manually
4. Check what's outputted in the appium log
Reply all
Reply to author
Forward
0 new messages