IOS应用程序无法使用触摸操作方法进行滚动

IOS应用程序无法使用触摸操作方法进行滚动,ios,scroll,appium,Ios,Scroll,Appium,我试过用下面的方法在屏幕上从上到下滚动,但它似乎根本没有反应。你知道原因是什么吗 公共空间{ 您没有使用perform()方法 试试这个代码 public void scrollTest() { Dimension dimension = driver.manage().window().getSize(); int scrollStartY = (int) (dimension.getHeight() * 0.5); int scrollEndY = (int) (di

我试过用下面的方法在屏幕上从上到下滚动,但它似乎根本没有反应。你知道原因是什么吗

公共空间{

您没有使用perform()方法

试试这个代码

public void scrollTest() {
    Dimension dimension = driver.manage().window().getSize();
    int scrollStartY = (int) (dimension.getHeight() * 0.5);
    int scrollEndY = (int) (dimension.getHeight() * 0.2);
    int scrollX = dimension.getWidth() / 2;
    int heightOffset = scrollStartY - scrollEndY;

    //Also note that in moveTo function, you have to provide the offSet values, not the (x,y) coordinates
    //of the point where you want to move. Hence, i have written 0 in x coordinate (as we don't want to 
    //change x coordinate) and calculated the heightOffset separately.
    new TouchAction(driver).press(scrollX, scrollStartY).moveTo(0, heightOffset).release().perform();
}
tc.longPress(scrollX,scrollStartY).moveTo(scrollX,scrollEndY).release().perform();
public void scrollTest() {
    Dimension dimension = driver.manage().window().getSize();
    int scrollStartY = (int) (dimension.getHeight() * 0.5);
    int scrollEndY = (int) (dimension.getHeight() * 0.2);
    int scrollX = dimension.getWidth() / 2;
    int heightOffset = scrollStartY - scrollEndY;

    //Also note that in moveTo function, you have to provide the offSet values, not the (x,y) coordinates
    //of the point where you want to move. Hence, i have written 0 in x coordinate (as we don't want to 
    //change x coordinate) and calculated the heightOffset separately.
    new TouchAction(driver).press(scrollX, scrollStartY).moveTo(0, heightOffset).release().perform();
}