简体   繁体   English

无法在Appium中使用swipe()滚动

[英]Unable to scroll using swipe() in Appium

I am unable to scroll down in Android using Appium. 我无法使用Appium在Android中向下滚动。

Code: 码:

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

Environment: 环境:

  • Appium Version: 1.4.16.1 Appium版本:1.4.16.1
  • Android Version: 6.1 Android版本:6.1
  • Java Version: 1.8.0_91 Java版本:1.8.0_91
  • Selenium: selenium-server-standalone-2.48.2 硒:硒服务器独立2.48.2
  • Java Client: java-client-3.2.0 Java客户端:java-client-3.2.0

Error: 错误:

org.openqa.selenium.WebDriverException: Not yet implemented. org.openqa.selenium.WebDriverException:尚未实现。 Please help us: http://appium.io/get-involved.html 请帮助我们: http : //appium.io/get-involved.html

Please let me know if there are any alternative ways to scroll. 请让我知道是否还有其他滚动方式。

Do you have a maven project? 你有一个Maven项目吗? Please update appium server: https://github.com/appium/appium-desktop 请更新appium服务器: https : //github.com/appium/appium-desktop

and your java-client to 4.1.2 (or even 5.0-BETA6) 和您的Java客户端到4.1.2(甚至是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) 无法在Java Client 6.0.0(Appium)上使用滑动功能

Try this Code: 尝试以下代码:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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