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()

相关推荐
唐樽9 分钟前
C++ 竞赛学习路线笔记
c++·笔记·学习
bobasyu42 分钟前
Claude Code 源码笔记 -- queryLoop
java·笔记·spring
水云桐程序员1 小时前
Quartus II集成开发环境 |FPGA
笔记·fpga开发·硬件工程·创业创新
禹中一只鱼2 小时前
【Charles 抓包工具笔记】(自用复盘版)
笔记·charles·抓包工具·配置代理
Java面试题总结2 小时前
Nginx 配置笔记
运维·笔记·nginx
一定要AK2 小时前
SpringMVC 入门核心笔记
笔记
海海不掉头发2 小时前
【11月16日-大模型前置知识【深度学习】+大模型开发入门】-基础篇笔记
人工智能·笔记·深度学习
ZhiqianXia2 小时前
PyTorch 学习笔记(18) : lowering.py
pytorch·笔记·学习
一定要AK3 小时前
HTML5 入门到精通全章节学习笔记
笔记·学习·html5
Engineer邓祥浩3 小时前
JVM学习笔记(7) 第三部分 虚拟机执行子系统 第6章 类文件结构
jvm·笔记·学习