appium / appium-uiautomator2-driver

Appium driver for Android UIAutomator2
Apache License 2.0
597 stars 175 forks source link

Mobile Scroll Gesture not working for Scrollview #728

Open jeromehuewe opened 9 months ago

jeromehuewe commented 9 months ago

When trying to scroll inside a android.widget.ScrollView using the Mobile Scroll Gestures the method directly returns false and thus stopping the scrolling.

[AndroidUiautomator2Driver@fe2d (6adddfbe)][0m Executing method 'mobile: scrollGesture'" [AndroidUiautomator2Driver@fe2d (6adddfbe)][0m Proxying [POST /appium/gestures/scroll] to [POST http://127.0.0.1:8200/session/49a372f4-3b90-4168-9bf0-1468588ae106/appium/gestures/scroll] with body: {'area':{'left':0,'top':238,'width':1080,'height':1861},'direction':'down','percent':1}" [AndroidUiautomator2Driver@fe2d (6adddfbe)][0m Got response with status 200: {'sessionId':'49a372f4-3b90-4168-9bf0-1468588ae106','value':false}" [AndroidUiautomator2Driver@fe2d (6adddfbe)][0m Responding to client with driver.execute() result: false"

Inspecting the element with Appium Inspector reveals that the element should be still scrollable:

The method is working totally fine, when scrolling a android.widget.ListView or android.widget.RecyclerView in the same App.

Is there an known issue with these types of elements or do I need to use other methods?

appium-uiautomator2-driver-version: 2.42.2 appium-version: 2.4.1

KazuCocoa commented 9 months ago

In the case, it looks like Android framework itself has the behavior. Appium provides some possible workarounds:

https://github.com/appium/appium-uiautomator2-driver?tab=readme-ov-file#mobile-scroll w3c actions example: https://github.com/appium/ruby_lib_core/blob/3d5a6def1e1b5e019467fab972d54e2a35c76b85/test/functional/common_w3c_actions.rb#L16 (the command differs on each client) https://www.w3.org/TR/webdriver1/#actions

shishircse commented 8 months ago

Scroll down is not working for RecyclerView and Layouts inside ScrollView in Android while using Appium(v2.4.1 and above i tried).

jeromehuewe commented 7 months ago

When using in Java boolean canScrollMore = (Boolean) ((JavascriptExecutor) driver).executeScript("mobile: scrollGesture", ImmutableMap.of( "left", 100, "top", 100, "width", 200, "height", 200, "direction", "down", "percent", 3.0 )); isn't this the same method you mentioned as a workaround? This is not working for the mentioned Android elements.