Is there a way of using scrollTo or scrollToExact methods for finding an element by a specific locator?

I’m wondering if I could use scrollTo/scrollToExact methods for scrolling view and to pass a MobileElement as parameter and not a string, because if I’m passing a string, scroll methods will fail.

I think this isn’t possible. But an possible workaround might be to scroll down and up via dpad actions and stop when you have found your element (which works only on Android):

while(isElementVisible(By.name(text)) == false){
    driver.sendKeyEvent(20); //dpad down			
}

Actually it performs the searching for scrollable elements and the scrolling by scripts, and then returns the element which is found:

Android: 1 2

iOS: 1

It is possible to perform the scrolling inside the element for iOS: prooflink. But you have to use IOSElement instead of MobileElement. …Or something like this:

((ScrollsTo) yourMobileElement).scrollTo(yourText);

@SergeyTichomirov When you say Scrollable elements, I believe this excludes the Layout views. IT is only applicable for Spinner or similar elements.
Correct me if I am wrong.

@aluedeke I am currently using the logic you mentioned, scroll using swipe till you find element.