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

相关推荐
啊我不会诶1 小时前
倍增法和ST算法 个人学习笔记&代码
笔记·学习·算法
逼子格1 小时前
振荡电路Multisim电路仿真实验汇总——硬件工程师笔记
笔记·嵌入式硬件·硬件工程·硬件工程师·硬件工程师真题·multisim电路仿真·震荡电流
一条破秋裤2 小时前
一份多光谱数据分析
笔记·数据挖掘·数据分析
zstar-_2 小时前
【算法笔记】6.LeetCode-Hot100-链表专项
笔记·算法·leetcode
程序员Xu3 小时前
【OD机试题解法笔记】连续出牌数量
笔记·算法·深度优先
彤银浦3 小时前
Web学习笔记2
笔记·学习
长风破浪会有时呀3 小时前
Git 学习笔记
笔记·git·学习
偷偷的卷3 小时前
【算法笔记 day three】滑动窗口(其他类型)
数据结构·笔记·python·学习·算法·leetcode
凤年徐4 小时前
【数据结构】时间复杂度和空间复杂度
c语言·数据结构·c++·笔记·算法
茫忙然4 小时前
【WEB】Polar靶场 Day8 详细笔记
笔记