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

相关推荐
细心的莽夫33 分钟前
Docker学习笔记
运维·笔记·后端·学习·docker·容器
再玩一会儿看代码1 小时前
pip 与 conda 的全面比较:Python 包管理的深度解析
经验分享·笔记·python·conda·课程设计·pip
Always_away1 小时前
数据库系统概论|第三章:关系数据库标准语言SQL—课程笔记3
数据库·笔记·sql·学习
MrsBaek2 小时前
前端笔记-JavaScript部分(上)
前端·javascript·笔记
小脑斧爱吃鱼鱼3 小时前
鸿蒙项目笔记(2)
笔记·学习·华为·harmonyos
0基础学习者4 小时前
按键消抖(用状态机实现)
前端·笔记·fpga开发·verilog·fpga
东方芷兰6 小时前
JavaWeb 课堂笔记 —— 08 请求响应
xml·java·笔记·spring·tomcat·html·idea
Jwoka6 小时前
正则表达式学习笔记
笔记·python·正则表达式·re
NULL指向我7 小时前
TMS320F28P550SJ9学习笔记14:EPWM_死区dead_baund
笔记·学习