[HELP] For examples with UiScrollable methods (scrollToEnd, scrollToBeginning,...)

Hello everyone,

I am using “findElementByAndroidUIAutomator” with UiScrollable to scroll items on dropdown but I cannot perform methods of UiScrollable.
I met error of UnsupportedCommandException “The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource.” because I did not know how use it when trying to use “driver.findElementByAndroidUIAutomator(“new UiScrollable(new UiSelector()).scrollToEnd(10);”);”.

Please help me some examples for UiScrollable methods.

Thank you very much.

1 Like

As per my understanding, you can use only those methods of UiScrollable class which accepts object of UiSelector class, few scroll examples are below:-

  1. scroll to an element using resource id:-
    driver.findElement(MobileBy.AndroidUIAutomator(“new UiScrollable(new UiSelector().”
    +“scrollable(true)).scrollIntoView(new UiSelector().resourceId(“resourceId”))”));

  2. scroll to an element using text value:-
    driver.findElement(MobileBy.AndroidUIAutomator(“new UiScrollable(new UiSelector().scrollable(true))”
    + “.scrollIntoView(new UiSelector().text(“textValue”))”));

browse UiSelector, UiScrollable classes of Android sdk for more options

Thanks @in-ishan for your examples.
I need more examples about UiScrollable methods (scrollToEnd, scrollToBeginning). Can you please help me ?