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

相关推荐
岩中竹14 分钟前
广东省省考备考(第四十九天7.18)——判断推理:位置规律(听课后强化训练)
笔记
Norvyn_71 小时前
LeetCode|Day18|20. 有效的括号|Python刷题笔记
笔记·python·leetcode
Y4090012 小时前
C语言转Java语言,相同与相异之处
java·c语言·开发语言·笔记
笑衬人心。2 小时前
TCP 拥塞控制算法 —— 慢启动(Slow Start)笔记
笔记·tcp/ip·php
花海如潮淹2 小时前
前端性能追踪工具:用户体验的毫秒战争
前端·笔记·ux
Andy杨3 小时前
20250718-5-Kubernetes 调度-Pod对象:重启策略+健康检查_笔记
笔记·容器·kubernetes
杭州杭州杭州9 小时前
Python笔记
开发语言·笔记·python
谢白羽12 小时前
jenkins搭建笔记
运维·笔记·jenkins
xiaoli232713 小时前
课题学习笔记1——文本问答与信息抽取关键技术研究论文阅读(用于无结构化文本问答的文本生成技术)
笔记·学习