I have appium studio since a while with Eclipse. Unable to mimic a swipe down action in iOS for a Native App. Any idea around code for swipe down action using java?

#1

The method swipe(int, int, int, int, int) is undefined for the type IOSDriver is the error being displayed in Eclipse.

0 Likes

#2

Try using http://appium.io/docs/en/writing-running-appium/touch-actions/ events rather than swipe.

1 Like

#3

Thanks for the quick turn around kishore, I have tried creating a swipeAction seems as per below code which isnt working, any guesses around what could I have been doing wrong?

    public void swipeHorizontal(double startPercentage, double finalPercentage, double anchorPercentage, int duration) {
    Dimension size = *iOSRemoteDriver* .manage().window().getSize();
    int anchor = (int) (size.height * anchorPercentage);
    int startPoint = (int) (size.width * startPercentage);

    int endPoint = (int) (size.width * finalPercentage);
    new TouchAction( *iOSRemoteDriver* ).press( *point* (anchor, startPoint))
    .waitAction( *waitOptions* (Duration. *ofMillis* (duration))).moveTo( *point* (anchor, endPoint)).release()
    .perform();
}
0 Likes

#4

Looks good to me

Similar code below did work to me some time back

TouchAction myAction = new TouchAction((MobileDriver)driver);
        Dimension size = driver.manage().window().getSize();
        int startY = (int) (size.height * 0.85);
        int endY = (int) (size.width * 0.05);
        int coordX = (int) (size.width * 0.50);
        `LOGGER.info("X = " + size.width + "; Y" + size.height );`
        myAction.press(coordX,startY).waitAction(3000).moveTo(coordX,endY).release().perform();
0 Likes