Can't figure out how to scroll on the Settings page with typescript & webdriver-io


I am trying to scroll on the settings page on my Android device. Here’s my environment

Android 11 phone
Appium 2.0.0-beta.64
Webdriver IO 7.26.0

I have a test that is trying to scroll on the settings page. I tried TouchActions’ touchPerform and that didn’t work. When I try it, I can see the entry in the Settings page get touched, and it looked like it long pressed, but it never scrolled.

{ action: ‘press’, options: { x: 360, y: 1420 } },
{ action: ‘moveTo’, options: { x: 360, y: 150 } },
{ action: ‘release’, options: {} },

And I tried touchScroll and that didn’t work. Nothing happened when I tried touchScroll.

driver.touchScroll(0, 150);

I have a few questions

@launchpadtt using UiScrollabe you can scroll a page until you find the valid element, so you need to create an object for the UiScrollabe class, this class(UiScrollabe) expects a selector as an argument to know which element to stop on, then you create a new UiSelector object that you pass it as an argument there is a method in the class(UISelector) called scrollIntoView and in that method you pass the text you want to scroll to. eg we want to iterate until it finds “cake”. So the code below will iterate until it finds the text we passed it.
driver.findElement(AppiumBy.androidUIAutomator("new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().textContains(\"cake\").instance(0))")).click();

another way is to use java script executor but it will scroll based on the coordinates and not the text we give it.