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

相关推荐
little_xianzhong8 小时前
三个常听到的消息/中间件MQTT RabbitMQ Kafka
java·笔记·中间件·消息队列
ysa05103010 小时前
虚拟位置映射(标签鸽
数据结构·c++·笔记·算法
songyuc11 小时前
《A Bilateral CFAR Algorithm for Ship Detection in SAR Images》译读笔记
人工智能·笔记·计算机视觉
01100001乄夵11 小时前
第二课:时序逻辑入门-零基础FPGA闯关教程
经验分享·笔记·学习方法
摇滚侠13 小时前
Spring Boot3零基础教程,Reactive-Stream 发布订阅写法,笔记104 笔记105
java·spring boot·笔记
循环过三天19 小时前
3.4、Python-集合
开发语言·笔记·python·学习·算法
昌sit!20 小时前
Linux系统性基础学习笔记
linux·笔记·学习
没有钱的钱仔21 小时前
机器学习笔记
人工智能·笔记·机器学习
好望角雾眠21 小时前
第四阶段C#通讯开发-9:网络协议Modbus下的TCP与UDP
网络·笔记·网络协议·tcp/ip·c#·modbus
仰望—星空1 天前
MiniEngine学习笔记 : CommandListManager
c++·windows·笔记·学习·cg·direct3d