Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile Scroll Gesture not working for Scrollview #728

Open
jeromehuewe opened this issue Jan 29, 2024 · 3 comments
Open

Mobile Scroll Gesture not working for Scrollview #728

jeromehuewe opened this issue Jan 29, 2024 · 3 comments

Comments

@jeromehuewe
Copy link

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:

<android.widget.ScrollView index="0" package="my.package" class="android.widget.ScrollView" text="" resource-id="my.package:id/main_scrollview" checkable="false" checked="false" clickable="false" enabled="true" focusable="true" focused="false" long-clickable="false" password="false" scrollable="true" selected="false" bounds="[0,238][1080,2099]" displayed="true">

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
Copy link
Member

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
Copy link

shishircse commented Mar 8, 2024

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

@jeromehuewe
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants