美文网首页
学习笔记-手势操作

学习笔记-手势操作

作者: sofiiii | 来源:发表于2019-11-12 20:51 被阅读0次

1. 引用

from appium.webdriver.common.touch_action import TouchAction

2. 轻敲,类似于click点击

使用方法:可以传元素或者是坐标
# todo 传元素点击轻敲
TouchAction(driver).tap(more_button).perform()
todo 传坐标点击
TouchAction(driver).tap(x=680,y=1045).perform()

3. 按压

使用方法:可以传元素或者是坐标
el = driver.find_element_by_xpath('//*[@text="开放源代码许可"]')
# todo 按压5秒后释放
TouchAction(driver).press(el).wait(5000).release().perform()

4. 长按

使用方法:可以传元素或者是坐标
# todo 长按6秒
el = driver.find_element_by_xpath('//*[@text="WiredSSID"]')
TouchAction(driver).long_press(el=el,duration=6000).perform()

5.等待 wait

6.release 释放

7.move_to 移动

相关文章

网友评论

      本文标题:学习笔记-手势操作

      本文链接:https://www.haomeiwen.com/subject/wrbqictx.html