滑动手势非常慢,...如何在 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();
有其他方法可以执行 swipe/scroll:
使用 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);
使用Swipe command available via SeeTest Appium Extension喜欢:
seetest.swipe("Right", 10, 500);
我的 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();
有其他方法可以执行 swipe/scroll:
使用
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);
使用Swipe command available via SeeTest Appium Extension喜欢:
seetest.swipe("Right", 10, 500);