0

I tried this piece of code:

scrollObject = dict(direction="down", text="some_text", element=appium_driver_elem.id)
self.driver.execute_script("mobile: scrollTo", scrollObject)

But I am getting an error saying:

"appium_driver_elem does not have attribute like id" or sometimes nosuchelementexception.

What is the simplest way to scroll with appium in android using python? Any full test examples?

3 Answers 3

2
self.driver.swipe(470, 1400, 470, x, 400)

self.driver.swipe(start_x, start_y, end_x, end_y, duration)

start_y value represents bottom Y value & end_y value represents top Y value of the screen in your app.

Since to scroll we hold screen at bottom & move up.

value of x depends on how much you wish to scroll in one shot. Example: To scroll to the bottom, try 300. To scroll little x can be 1200

Sign up to request clarification or add additional context in comments.

Comments

0

Still haven't found an answer. So maybe you need to play a little bit rough. You can use the self.driver.scroll(self,SrcElem,DestElem) function to swipe screen from bottom to top and check the element you seek.

Comments

0

Or You can also try to do

from appium.webdriver.common.touch_action import TouchAction
...
action = TouchAction(self.driver)
action.press(start_element).move_to(end_element).release().perform()

Actually, that's how scroll() function works. Once, I had an issue with self.driver.scroll(), so this can also be a workaround.

1 Comment

Thanks @Kandume-Luckcraft

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.