As per your example,
Follow these steps:
- Get the list of elements for first three buttons, store the count in some variable:
List<WebElement> list = (List<WebElement>) driver.findElements(By.xpath("your xpath"));
(you can use your locator strategy as per requirement)
public static void scrollDown() {
int pressX = driver.manage().window().getSize().width / 2;
int bottomY = driver.manage().window().getSize().height * 4/5;
int topY = driver.manage().window().getSize().height / 8;
scroll(pressX, bottomY, pressX, topY);
}
public static void scroll(int fromX, int fromY, int toX, int toY) {
TouchAction touchAction = new TouchAction(mobileDriver);
touchAction.longPress(PointOption.point(fromX, fromY)).moveTo(PointOption.point(toX, toY)).release().perform();
}
- Again get the list of elements for the last three buttons, store the count in some variable.
List<WebElement> list2 = (List<WebElement>) driver.findElements(By.xpath("your xpath"));
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…