python-3.x - 如何使用 Python 在 Appium 测试中滚动/滑动?
问题描述
我正在尝试从英尺滚动/滑动到 m。在我的 Appium 中使用 Python 测试。英尺的可访问性 ID 是ft.
,公制是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 循环的值
推荐阅读
- c# - Google Drive API V3 内存不足下载大文件
- apache-flink - Flink 中使用定义的聚合函数 - 未找到函数签名的匹配项
- javascript - Vue js, controlling the child component renders from parent component or synch the data of parent component's data to child components data?
- asp.net-core - Entity Framework Core 5 似乎不支持 Where/Include
- typescript - Typescript 扩展了一个泛型类型的类
- c - 使声明的变量引用已经存在的内核符号
- typescript - 没有重载需要 3 个参数,但确实存在需要 3 个或 Infinity 参数的重载
- javascript - 如何使用 javascript 将对象作为参数传递给 ng-click
- data-warehouse - 维度表:是否值得创建一个只有 2 个值的维度?
- c# - Trouble understanding scope of Variables between forms