3 回答

TA貢獻(xiàn)1802條經(jīng)驗 獲得超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貢獻(xiàn)1777條經(jīng)驗 獲得超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貢獻(xiàn)1848條經(jīng)驗 獲得超6個贊
對于垂直/水平滑動,我使用的是 TouchAction:
TouchAction touchAction = new TouchAction((PerformsTouchActions) driver); touchAction.press(startPoint) .waitAction(WaitOptions.waitOptions(Duration.ofMillis(waitBetweenSwipes))) .moveTo(endPoint) .release() .perform();
添加回答
舉報