- 安装python3.7.4 下载地址
- 配置环境变量
- 下载安装adb 下载地址
- adb.exe 加入Path环境变量
- 查看版本,检测是否安装成功
D:workpyqt_5.12.1>adb version Android Debug Bridge version 1.0.41 Version 33.0.1-8253317 Installed as D:workplatform-toolsadb.exeadb常用指令
adb devices # 查看当前设备 adb shell pm list packages # 查看手机里面所有包名 adb shell pm list packages -3 # 查看手机里面所有第三方包名 adb shell dumpsys activity activities # 该命令的功能是获取当前正在被操作的app的activity相关信息 adb shell pm clear com.ablesky.ui.activity # 清除缓存数据 # 启动程序 # 格式:常规命令 + 包名/activity # 注意:appActivity返回值本来是com.jingdong.app.mall/.main.MainActivity,需要去掉中间的反斜线! adb shell am start -n com.jingdong.app.mall/com.jingdong.app.mall.MainFrameActivity adb shell pm clear com.jingdong.app.mall # 关闭程序并且清除所有数据,相当于重新安装 adb shell am force-stop com.jingdong.app.mall # 停止运行程序 adb shell "ps | grep com.jingdong.app.mall" # 查看程序进程,判断是否运行 adb shell /system/bin/screencap -p /sdcard/xx.png # 截频并保存文件在手机上为xx.Png adb pull /sdcard/xx.png D:/xx.png # 将手机xx.png文件保存到D盘文件下 adb push D:/xx.text /adcard/xx.text # 将电脑文件导入手机 adb shell screenrecord /sdcard/demo.mp4 # 录制视频 adb shell input text 123 # 输入内容 adb shell input keyevent 4 # 按键操作 # 4 返回操作 # 1 菜单 # 3 主页 # 21 光标左移 # 22 光标右移 # 67 删除 # 61 tab adb shell input tap 282 923 # 点击某个坐标 adb shell input swipe 300 1000 300 500 # 下滑500px adb shell input swipe 288 929 288 929 1000 # 长按1000msuiautomator2 uiautomator2安装
- 安装uiautomator2
# 用于控制手机 核心包 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --pre -U uiautomator2 pip install pillow # 这个包用于截图,有需要可以装
- 安装atx,用于控制手机app
python -m uiautomator2 init # 手机端安装ATXuiautomator2常用方法
weditorhttps://blog.csdn.net/adorable_/article/details/121998945
# 可能会安装失败 pip install -i https://pypi.douban.com/simple weditor # 豆瓣安装 pip install --pre -U weditor # 上面如果安装失败的话 直接安装指定版本 0.6.4 / 0.6.3 pip install --upgrade weditor==0.6.4 # 启动 weditor python -m weditor # 创建快捷方式 python -m weditor –shortcut夜神模拟器 下载安装
下载地址亲测可用
adb版本不一致问题-
安装完毕以后,设置分辨率等参数
-
打开开发者模式,打开设置 滑到最下面 疯狂点击版本号
-
开启usb调试模式,开启指针位置,方便查看坐标
-
把adb安装目录下的 adb.exe 重命名,放入夜神模拟器bin目录替换文件(替换之前先备份一下)。
uiautomatorviewer.bat 无法连接解决办法 :https://www.jianshu.com/p/c8581a70d1bc



