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?

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

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

1 Like

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()

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 );`
1 Like