![](/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.