Issue with scrollTo and scrollToExact methods of Android Driver. Methods do not scroll to required element text, but scroll to end of page

same problem with appium 1.4 + java client 2.2.0

Can you please share the code with which you are trying to perform scroll action

It’s simply
getDriver().scrollTo(account.getAccountName());
where account.getAccountName() returns a string

It’s perfect and should work if getDriver() is AndroidDriver

Hi,
Can you please provide the code snippet. For me it tries to scrolls up instead of down.

Thanks,
Mervin

Please refer below post:

Hi Mitesh,
Thanks for the quick reply.

In my case I want to scroll to particular text and select it. So if I’m using only scrollTo function it scrolls up instead of down.

Can you please help me to achieve it.

Thanks in advance

Hello Dinesh,

In my case,I am using driver.scrollTo(“text to be located”) to scroll and locate the particular text.As soon as I execute this command it’s scroll the whole UI for single time and then goes for locating it.

Also if we need to click the located element then simply use click event with it i.e. driver.scrollTo(“text to be located”).click();

Let me know if you still face the issue.

I tried this , still it scrolls up instead of down.

Don’t know what’s the issue then might be the appium or device issue because in my case it’s working absolutely fine

Thanks for the reply, will try to find the issue and post it here

Same problem with Appium v1.4.0, JavaClient 3.1.0 on real Android device v4.4.

Driver.scrollTo just goes 8 rows down and up again repeating several times. Record I am looking for is on 20th row, so it never gets visible.

1 Like

I have problem with scrolling more than 200 elements in the list. Does anyone have solution for this?

Can you please explain what problem you are facing? Android or iOS ? Little explanation will help

I am testing Android app, scrolling works for list which is having less elements but it is fails to scroll long list say more than 200. When I use scroll function to scroll to element in long list, it scroll up to certain element then it fails saying element couldn’t be found.

I think better to develop an algorithm. pseudo could be like this:

Take the list of visible elements
take position of first visible element
take position of last visible element
swipe from last visible element to first visible element
continue swiping until the list of all visible elements is not same

Hope it would work.

driver.scrollTo(“some text”) crashes :’( … The app stops there and the automation stops … Need urgent help

This worked for me on Android with Appium Python client:

element_to_tap = self.driver.find_element_by_id(“com.demoapp.cool:id/mySizeButton”)
element_to_drag_to = self.driver.find_element_by_id(“com.demoapp.cool:id/guideToSizeButton”)
self.driver.scroll(element_to_tap, element_to_drag_to)
sleep(10)

get the id from your android app and replace it in the places of ‘mySizeButton’ and ‘guideToSizeButton’

Hi,
Can you please elaborate your answer?
element_to_tap and element_to_drag_to means exactly what you trying to do?

In simple words, consider you have a list of options inside the menu page - A, B, C, D & E while E is at the end and you have to scroll up to view it. Assume with a real device in hand you will manually try to scroll up, so you will put finger in point 2 and scroll it till point 1 (down to up finger movement). I’m doing the same in my code.

A
B
C
D

E
element_to_tap = D
element_to_drag_to = B

and say Appium to scroll up from D to B, so my screen will move up and I will be shown the options in the bottom. Hope this helps you understand it better.