[英]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();
有其他方法可以執行滑動/滾動:
使用如下的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);
使用可通過SeeTest Appium Extension可用的Swipe命令,例如:
seetest.swipe("Right", 10, 500);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.