[英]How to scroll to an element that does not appear in the view using python and appium
我尝试使用以下功能通过未出现在显示屏中的文本滚动到元素
self.driver.find_element_by_android_uiautomator("new UiScrollable(new UiSelector().scrollable(true)" + ".instance(0)).scrollIntoView(new UiSelector().text('מטבע חוץ').instance(0))")
self.driver.find_element_by_android_uiautomator('new UiScrollable(new UiSelector().scrollable(true).instance(0)).getChildByText(new UiSelector().className("android.widget.TextView"), "' + text + '")')
函数不滚动元素
这是我想要的能力
desired_cap = {
"deviceName": deviceName,
"udid":uid,
"platformName": "Android",
"platformVersion": platformVersion,
"automationName":"UiAutomator2",
"appPackage": "com.******.********",
"appActivity": "com.*****.ui.*********"
}
我知道有一种触摸操作方法,但它仅适用于可见元素。
for each in range(1, 2):
driver.swipe(500, 1700, 500, 1000, 400)
如果您需要滚动的次数超过更改范围值,这会滚动屏幕 2 次。 例如,滚动 10 次就像 range(1, 10)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.