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

相关推荐
鹏北海-RemHusband7 小时前
Go 语言进阶笔记 — 面向 JS/TS 前端开发者
笔记·golang
nnsix8 小时前
Unity QFramework ResKit、UIKit 笔记
笔记
摇滚侠9 小时前
Java 零基础全套教程,反射机制,笔记 187-188
java·开发语言·笔记
【云轩】9 小时前
如何设计一台能模拟电机的电子负载:一个硬件工程师的实战笔记
笔记·嵌入式硬件
可信计算11 小时前
X司民用无人机运行安全与合规培训手册
笔记
李子琪。11 小时前
Web漏洞-CSRF-CSRF防御 实验步骤
经验分享·笔记
小碗羊肉12 小时前
【Agent笔记 | 第四篇】Agentic RAG
笔记
小雨xs13 小时前
Vulnhub靶场DC-9 渗透测试笔记
笔记
whyTeaFo13 小时前
MIT 6.1810: xv6 book Chapter3: Page tables 笔记
笔记
東雪木14 小时前
JVM 与 Java 内存模型 专属复习笔记
java·jvm·笔记·java面试