【发布时间】:2019-01-18 05:41:46
【问题描述】:
滑动磁贴适用于除天气屏幕等动画图像之外的所有其他磁贴/图像。这是我用于滑动普通磁贴/图像的工作代码。
public static void swipeTile(AppiumDriver driver, MobileElement element) {
try {
element.isDisplayed();
int startX = Math.toIntExact(Math.round(element.getSize().getWidth()));
int endX = Math.toIntExact(Math.round(element.getSize().getWidth() / 2));
int startY = element.getLocation().getY();
TouchAction action = new TouchAction(driver);
action.longPress(startX,startY).waitAction(500).moveTo(endX, startY).release().perform();
driver.performTouchAction(action);
}
catch (Exception e) {
e.getMessage();
}
}
【问题讨论】:
-
您是想滚动到页面还是请与我们分享您到底想做什么
-
我想向左滑动平铺图像。如果我在容器中向左滑动第一个图像,则一次出现一个容器,下一个图像将出现。这两个图像也有不同的 id。 id 类似于 weather_details_today_container_0 和 weather_details_today_container_1
-
你会分享图片链接还是分享截图