电脑连接上一个手机或多个手机, 确保adb已经添加到环境变量中,执行下面的命令会自动安装本库所需要的设备端程序:uiautomator-server 、atx-agent、openstf/minicap、openstf/minitouch
https://gitee.com/ran_yong/uiautomator2
https://github.com/openatx/uiautomator2
安装
安装uiautomator2
pip install --pre uiautomator2
pip install pillow
使用:
python -m uiautomator2 init
安装完成,设备上会多一个uiautomator的应用。
1、安装:
pip install --pre --upgrade weditor
2、使用:
python3 -m weditor
指令:
d.screen_on()#打开屏幕
d.screen_off()#关闭屏幕
d.press(“home”)#按home键,用键名
d.press(“back”)#按返回键,与主要的名称
d.unlock()解锁屏幕
# 全局变量设置
d.settings['operation_delay'] = (0, 5) # 设置每次操作后自动等待5秒
d.implicitly_wait(5.0) # 等待特定元素出现 on click,long_click,drag_to,get_text,set_text,clear_text,etc.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?