public static void scrollToDirection(WebElement webElement, String direction) {
HashMap<String, Object> parameter = new HashMap<>();
parameter.put("elementId", ((RemoteWebElement)webElement).getId()); // Here getting issue
parameter.put("direction", direction);
parameter.put("percent", 1.0);
parameter.put("speed", 15000);
((JavascriptExecutor) getAppiumDriver()).executeScript(
"mobile: scrollGesture", parameter
);
}
Error
java.lang.ClassCastException: class com.sun.proxy.$Proxy69 cannot be cast to class org.openqa.selenium.remote.RemoteWebElement (com.sun.proxy.$Proxy69 and org.openqa.selenium.remote.RemoteWebElement are in unnamed module of loader 'app')
Note: I am using Proxy to locate random elements