繁体   English   中英

滑动手势非常慢,…如何在android中加快我的滑动手势?

[英]Swipe gesture is very slow,…how to speed up my Swipe Gesture in android?

我的Appium测试具有水平滑动手势,但是执行滑动手势时速度很慢。 有什么可行的方法吗? 建议将不胜感激。

我已经添加了一些waitAction()但没有帮助

  public void horizontalSwipeRightToLeft(AndroidDriver driver){
        Dimension deviceDim = driver.manage().window().getSize();
        int height = deviceDim.getHeight();
        int width = deviceDim.getWidth();
        int y = (int) (height*0.20);
        int startX = (int) (width*0.80);
        int endX = (int) (width*0.20);
        TouchAction swipe = new TouchAction(driver);
        swipe.longPress(point(startX,y))
                .moveTo(point(endX,y)).release()
                .perform();
    }

并且我也尝试了这段代码,但是它的输出与您看到的一样,我增加了一些持续时间。

TouchAction swipe = new TouchAction(driver);
        swipe.longPress(LongPressOptions.longPressOptions()
                .withPosition(point(startX,y))
                .withDuration(Duration.ofMillis(250)))
                .moveTo(point(endX,y)).release()
                .waitAction(WaitOptions.waitOptions(Duration.ofMillis(100)))
                .perform();

有其他方法可以执行滑动/滚动:

  1. 使用如下的mobile:shell命令:

     Map<String, Object> args = new HashMap<>(); args.put("command", "input"); args.put("args", Lists.newArrayList("swipe", "startX","startY","endX","endY")); driver.executeScript("mobile: shell", args); 
  2. 使用可通过SeeTest Appium Extension可用的Swipe命令,例如:

     seetest.swipe("Right", 10, 500); 

暂无
暂无

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

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