Generic function for Scroll where scrollablelist is the locator of scroll view in which we have to scroll
public void scrollToElementWithText(RemoteWebDriver driver, String scrollableList, String text) {
MobileElement element = (MobileElement) driver
.findElement(MobileBy.AndroidUIAutomator("new UiScrollable(new UiSelector().resourceId(\""
+ scrollableList + "\")).scrollIntoView(" + "new UiSelector().text(\"" + text + "\"))"));
}
You can try below code with in existing code
scrollable(true).instance(0))Add in desired capability
UiAutomator2if you are usingappiumasautomationengine.Now use below functions if you have element's id, and index as 0 for there is one element on page.
Scroll using Text
Scroll using help of screen size: