[英]How to scroll/swipe in Appium tests using Python?
I am trying to scroll / swipe from ft. to m.我正在尝试从英尺滚动/滑动到米。 in my Appium with Python test.
在我的 Appium 中用 Python 测试。 Accessibility id for feet is
ft.
and for metric is m.
英尺的可访问性 ID 是
ft.
,公制的可访问性 ID 是m.
Here is the code snippet I am trying to use to do this but the ft.
doesn't switch to 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()
How can I change it to m.?我怎样才能把它改成m.? (In the picture below I have played with the swipe but I can't be dependent on the coordinates)
(在下面的图片中,我玩过滑动但我不能依赖坐标)
Try this尝试这个
for each in range(1, 2):
driver.swipe(500, 1700, 500, 1000, 400)
Change the value on for loop according to to the swipes required根据所需的滑动更改 for 循环上的值
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.