3 回答
TA贡献1802条经验 获得超5个赞
我的刷卡方法:
public void swipe(int startX, int startY, int endX, int endY, int msDuration) {
TouchAction touchAction = new TouchAction(mDriver);
touchAction.press(PointOption.point(startX, startY))
.waitAction(WaitOptions.waitOptions(Duration.ofMillis(msDuration)))
.moveTo(PointOption.point(endX, endY))
.release();
touchAction.perform();
}
TA贡献1777条经验 获得超3个赞
尝试这个
String scrollViewContainer_finder = "new UiSelector().resourceIdMatches(\".*id/your_scroll_view_id\")";
String neededElement_finder = "new UiSelector().resourceIdMatches(\".*id/elemnt1\")";
WebElement abc = driver.findElement(MobileBy.AndroidUIAutomator("new UiScrollable(" + scrollViewContainer_finder + ")" +
".scrollIntoView(" + neededElement_finder + ")"));
TA贡献1848条经验 获得超6个赞
对于垂直/水平滑动,我使用的是 TouchAction:
TouchAction touchAction = new TouchAction((PerformsTouchActions) driver); touchAction.press(startPoint) .waitAction(WaitOptions.waitOptions(Duration.ofMillis(waitBetweenSwipes))) .moveTo(endPoint) .release() .perform();
添加回答
举报