无法使用TouchAction滚动

时间:2019-05-14 15:23:53

标签: java appium

我能够使用我通过触摸操作编写的滚动方法,但是现在运行它时出现编译错误。我现在应该使用什么或者该怎么解决编译问题?

public void scrollDown() {

    AndroidDriver androidDriver = ((AndroidDriver)((WebDriverFacade) getDriver()).getProxiedDriver());
    TouchAction touchAction = new TouchAction(androidDriver);

    Dimension size = androidDriver.manage().window().getSize();
    int startX = size.width / 2;
    int startY = (int) (size.height * 0.60);
    int endY = (int) (size.height * 0.30);
    touchAction.longPress(startX, startY).moveTo(startX, endY).release().perform(); // error on this line pointing to startX and startY within longpress()
}

下面是编译错误

method io.appium.java_client.TouchAction.longPress(io.appium.java_client.touch.offset.PointOption) is not applicable
  (actual and formal argument lists differ in length)

2 个答案:

答案 0 :(得分:0)

您缺少工期参数

new TouchAction(driver).press(ElementOption.element(element1)) .waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3))).moveTo(ElementOption.element(element2)).release().perform();

答案 1 :(得分:0)

您可以使用以下方法滑动屏幕

WHERE (col_1 > 0) and ... (col_99 > 0)