I’m using Appium 1.20. I’m trying to find a way to scroll to an element.
public static void scrollToElement(WebElement e) {
JavascriptExecutor js = driver;
HashMap scrollObject = new HashMap();
scrollObject.put(“direction”, “down”);
scrollObject.put(“name”, e.getId()); // <– there is no getId for WebElement.
js.executeScript(“mobile: scroll”, scrollObject);
}
Unfortunately, there is no getId() for WebElement.
How do you scroll to an element in Appium 2?
Source: Read More