![](/img/trans.png)
[英]How to scroll to an element that does not appear in the view using python and appium
[英]How to scroll/swipe in Appium tests using Python?
我正在嘗試從英尺滾動/滑動到米。 在我的 Appium 中用 Python 測試。 英尺的可訪問性 ID 是ft.
,公制的可訪問性 ID 是m.
這是我試圖用來執行此操作的代碼片段,但ft.
沒有切換到m.
WebDriverWait(driver, 20).until(EC.presence_of_element_located((By.ACCESSIBILITY_ID, "ft.")))
start = driver.find_element_by_accessibility_id("ft.")
time.sleep(1)
WebDriverWait(driver, 20).until(EC.presence_of_element_located((By.ACCESSIBILITY_ID, "m.")))
end = driver.find_element_by_accessibility_id("m.")
time.sleep(1)
TouchAction(driver).press(start).move_to(end).release().perform()
我怎樣才能把它改成m.? (在下面的圖片中,我玩過滑動但我不能依賴坐標)
嘗試這個
for each in range(1, 2):
driver.swipe(500, 1700, 500, 1000, 400)
根據所需的滑動更改 for 循環上的值
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.