简体   繁体   中英

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:

  • Appium Version: 1.4.16.1
  • Android Version: 6.1
  • Java Version: 1.8.0_91
  • Selenium: selenium-server-standalone-2.48.2
  • Java Client: java-client-3.2.0

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.

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);
    }

不要使用WebDriver。使用AndroidDriver或强制转换为AndroidDriver。

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

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

Try this Code:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM