метод scrollToText:
Код: Выделить всё
public void scrollToText(String text) {
driver.findElement(AppiumBy.androidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(text(\"" + text + "\"))"));
}
Код: Выделить всё
public void scrollUp() {
boolean canScrollMore;
do {
canScrollMore = (Boolean) ((JavascriptExecutor) driver).executeScript("mobile: scrollGesture", ImmutableMap
.of("left", 100, "top", 100, "width", 200, "height", 200, "direction", "up", "percent", 3.0));
} while (canScrollMore);
}
Код: Выделить всё
public void scrollAndView(String visibleText) {
driver.findElement(AppiumBy.androidUIAutomator(
"new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().textContains(\"" + visibleText + "\").instance(0))"));
}
Элементы не прокручиваются должным образом, и я не получаю никаких ошибок. или исключения.
Подробнее здесь: https://stackoverflow.com/questions/791 ... ium-script