Slavic Turo
Slavic Turo

Reputation: 13

How to scroll down on Appium when you have multi plages to go down?

enter image description here

How do I scroll down when you have multiple pages. On the third page bottom there is a link but when I use driver.scrollTo();, it skips it goes back to first page.

Upvotes: 0

Views: 322

Answers (3)

Devdutta Goyal
Devdutta Goyal

Reputation: 1135

try driver.swipe method

Visit this link

https://automationbyharsh.blogspot.in/2017/01/how-driverswipe-works-on-ios.html

Upvotes: 0

Harveer Singh
Harveer Singh

Reputation: 91

this is java code, and it should work fine for scrolling.

Upvotes: 0

Harveer Singh
Harveer Singh

Reputation: 91

you can use JavaScriptExecutor for scrolling i have created below method for scrolling it is working fine in iOS but have not tested for Android

public static void swipe(AppiumDriver<?> driver,String sDirection, int iCount)

{
    while(iCount>0)
    {
        HashMap<String,String> swipeObject=new HashMap<String,String>();
        swipeObject.put("direction", sDirection);

        JavascriptExecutor jsDriver=(JavascriptExecutor)driver;

        jsDriver.executeScript("mobile:scroll", swipeObject);
        iCount--;

    }
}

hope it might help :)

Upvotes: 1

Related Questions