appium2.0+ 单点触控和多点触控新的解决方案

#获取设备的大小 -

sizesize_dict = driver.get_window_size()

==========放大地图:从地图中心分别向对角线滑动放大 - 2个手指同时执行滑动操作

actions = ActionChains(driver)

#输入源设备列表为空actions.w3c_actions.devices = \[\]

========== 第1个手指:从正中心向右上角滑动 ==================

#添加一个新的输入源到设备到中,输入源类型为Touch,id为finger0

new_input = actions.w3c_actions.add_pointer_input('touch','finger0')

#输入源的动作:移动到某个点,按下,移动到另外一点,释放new_input.create_pointer_move(x=size_dict"width" * 0.5, y=size_dict"height" * 0.5)new_input.create_pointer_down()

new_input.create_pointer_down(MouseButton.LEFT)

new_input.create_pause(0.2) # 200ms

new_input.create_pointer_move(x=size_dict"width" * 0.9, y=size_dict"height" * 0.1)

new_input.create_pointer_up(MouseButton.LEFT)

========== 第2个手指:从正中心向左下角滑动 ==================

#添加一个新的输入源到设备到中,输入源类型为Touch。id为finger1

new_input = actions.w3c_actions.add_pointer_input('touch','finger1')

#输入源的动作:移动到某个点,按下,移动到另外一点,释放new_input.create_pointer_move(x=size_dict"width" * 0.5, y=size_dict"height" * 0.5)

new_input.create_pointer_down()# new_input.create_pointer_down(MouseButton.LEFT)

new_input.create_pause(0.2) # 200ms

new_input.create_pointer_move(x=size_dict"width" * 0.1, y=size_dict"height" * 0.9)

new_input.create_pointer_up(MouseButton.LEFT)

#执行动作

actions.perform()

相关推荐
知产xiao_xin9 小时前
知识产权入门 —— 相关权(邻接权)
经验分享·笔记·知识产权
自小吃多10 小时前
DXF文件导入与PCB板框定义笔记
笔记·嵌入式硬件
jike_202611 小时前
iPhone采访录音同时拍现场照片的APP:图片音频同步记录实测
笔记·智能手机·音视频·语音识别
————A13 小时前
Agent 接收用户上传文件
人工智能·笔记·python·状态模式
奔跑的痕迹13 小时前
如何删除引力画报?
笔记
zbyyd13 小时前
Linux 进程间通信学习笔记
linux·笔记·学习
知产xiao_xin13 小时前
知识产权入门 —— 版权
经验分享·笔记·知识产权
呆萌很14 小时前
英语 1‑12 月单词联想记忆
笔记
金立基包装胶水15 小时前
纸袋热封频繁不良,先排查胶料这一堆问题
大数据·笔记·其他
常驻客栈16 小时前
B-深入理解计算机系统第3版之第11章:网络编程
开发语言·笔记·学习笔记·常驻客栈·深入理解计算机系统