如何使用 Android 驱动程序将顶部滚动到底部 [英] How to scroll top to botton using Android driver
问题描述
我尝试使用 scrollTo() 使用 andriod 驱动程序滚动我的应用程序页面,但没有成功,因为它已从 javaclient 4.1.2 中弃用.
I tried scrollTo() to scroll my app page using andriod driver, but not worked because it is deprecated from javaclient 4.1.2.
我已经浏览了以下链接,但找不到任何解决方案.如何才能我使用 appium 驱动程序从上到下滚动 Android 应用程序页面?
I have gone through below link but couldn't find any solution . How can I scroll an android app page from top to bottom using appium driver?
请给我解决方案
推荐答案
我的例子来自 python,但它也适用于 Java 并且只使用 java 语法来查找元素
My example is from python but it will work for Java as well just use java syntax to find element like
driver.find_element_by_android_uiautomator('new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().textContains("**/Put some text which is at bottom of screen to scroll screen/**").instance(0))')
有关更多详细信息,您可以访问 https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable.html 和 https://developer.android.com/training/testing/ui-testing/uiautomator-testing.html
for more details you can go-through the https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable.html and https://developer.android.com/training/testing/ui-testing/uiautomator-testing.html
这篇关于如何使用 Android 驱动程序将顶部滚动到底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!