Vijay Patil
Vijay Patil

Reputation: 1

Unable to scroll using swipe() in Appium

I am unable to scroll down in Android using Appium.

Code:

driver.swipe(0, 0, 450, 250, 2000);

Environment:

Error:

org.openqa.selenium.WebDriverException: Not yet implemented. Please help us: http://appium.io/get-involved.html

Please let me know if there are any alternative ways to scroll.

Upvotes: 0

Views: 708

Answers (3)

Saurabh Patel
Saurabh Patel

Reputation: 1

Unable to use swipe as a function on java client 6.0.0 (appium)

Try this Code:

driver.swipe(780, 1400, -26, 1286, 682);

Upvotes: 0

SaiPawan
SaiPawan

Reputation: 1194

Do not use WebDriver.Use AndroidDriver or cast to AndroidDriver.

(AndroidDriver<WebElement>)driver.swipe(0,0,450,250,2000);

Upvotes: 0

David Ep
David Ep

Reputation: 270

Do you have a maven project? Please update appium server: https://github.com/appium/appium-desktop

and your java-client to 4.1.2 (or even 5.0-BETA6)

For correct scrolling like a real user swiping in the middle of the screen, use this function (you can change it according to your needs):

public void scrollDown() {
        Dimension size = driver.manage().window().getSize();
        int starty = (int) (size.height * 0.7);
        int endy = (int) (size.height * 0.2);
        int startx = size.height / 2;
        driver.swipe(startx, starty, startx, endy, 800);
    }

Upvotes: 0

Related Questions