[英]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.