0

I'm testing Android application and need to scroll text. I have tried everything I found here and on a Internet but nothing is working.

Appium v1.4.1 (Server v1.7.2) Python 3.x Using selenium webdriver

I need scroll to the bottom of a page, not to specific element

The closest is

self.driver.execute_script("mobile: scroll", {"direction": "up"}) 

but it is not working . Log is: selenium.common.exceptions.WebDriverException: Message: Unknown mobile command "scroll". Only shell commands are supported.

Thanks

1
  • self.driver.execute_script("mobile: scroll", {"direction": "up"}) This seems the closest what I need Commented Mar 26, 2018 at 8:01

1 Answer 1

1

For Android there are 2 good options when it takes to scrolling:

actions = TouchActions(driver) el = driver.find_element_by_id(<id of element you press to start swipe>) action.press(el).move_to(x=100, y=-1000).release().perform()

You can also get screen size of the device to scroll more precisely:

screen_size = driver.get_window_size()

self.driver.find_element_by_android_uiautomator('new UiScrollable(new UiSelector().resourceId("<id of scrollable view>")).scrollIntoView(new UiSelector().resourceId("<id of element to scroll to>"))')

You can read more here

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

Comments

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.