Scroll to methods :
Android
public static void scrollToElement(AndroidDriver driver, String elementName, boolean scrollDown){
String listID = ((RemoteWebElement) driver.findElementByAndroidUIAutomator("new UiSelector().className(\"android.widget.ListView\")")).getId();
String direction;
if (scrollDown) {
direction = "down";
} else {
direction = "up";
}
HashMap<String, String> scrollObject = new HashMap<String, String>();
scrollObject.put("direction", direction);
scrollObject.put("element", listID);
scrollObject.put("text", elementName);
driver.executeScript("mobile: scrollTo", scrollObject);
}
iOS
public static void scrollToElement(IOSDriver driver,String elementName) {
String targetCell = "//UIATableCell[UIAStaticText[@name=\""+elementName+"\"]]";
WebElement cellWithText = driver.findElement(By.xpath(targetCell));
HashMap<String, String> scrollObject = new HashMap<String, String>();
scrollObject.put("element", ((RemoteWebElement)cellWithText).getId());
driver.executeScript("mobile: scrollTo",scrollObject);
}