I have an app page where I need to scroll vertically to reach an element of the app.
I've googled and tried many solutions. Many commands are deprecated and don't support anymore in appium. Also, previous questions/answers in Stack didn't help me. I'm using appium v1.13.0 + Java (IntelliJ).
Sometimes I see this error:
java.lang.ClassCastException: io.appium.java_client.android.AndroidDriver cannot be cast to org.openqa.selenium.interactions.HasTouchScreen
Anyway, my problem isn't just to solve the mentioned error. I'm looking for workable and correct commands to make a scroll action with appium. Please bring me the complete sample project cause I'm junior. Thanks
Try this
String scrollViewContainer_finder = "new UiSelector().resourceIdMatches(\".*id/your_scroll_view_id\")";
String neededElement_finder = "new UiSelector().resourceIdMatches(\".*id/elemnt1\")";
WebElement abc = driver.findElement(MobileBy.AndroidUIAutomator("new UiScrollable(" + scrollViewContainer_finder + ")" +
".scrollIntoView(" + neededElement_finder + ")"));