参考文档地址:https://blog.csdn.net/weixin_43916473/article/details/108534460
windows下环境搭建
JDK环境搭建
建议jdk>=1.8
1.下载JDKhttps://www.oracle.com/java/technologies/javase-downloads.html
2.配置环境变量
新建系统变量,变量名JAVA_HOME,变量值为JDK的安装路径。
编辑系统变量Path,新增两个变量
%JAVA_HOME%\bin
%JAVA_HOME%\jre\bin
最后确认结果,java -version
安装appium-desktop
下载地址:https://github.com/appium/appium-desktop/releases/
不需要安装NodeJS
appium-desktop集成了appium inspector,appium server
安装夜神模拟器
打开电脑vt状态
夜神配置本地环境变量:
将本地环境adb.exe替换至夜神bin目录下,重命名为nox_adb.exe
夜神连接adb:nox_adb.exe connect 127.0.0.1:62001
adb devices查看设备连接状态
adb kill-server 重启server
appium -g 日志地址日志名字(生成日志)
Windows查看当前app的activity:adb shell dumpsys window|findstr mCurrent
macos下环境搭建
appium-desktop安装包:https://blog.csdn.net/weixin_41696733/article/details/105781911
安装环境参考:https://blog.csdn.net/weixin_36192992/article/details/124260978
遇到的坑:
1.Appium连接手机时报权限错误 Security exception: Permission Denial: starting Intent
解决方式:desired capacities 中的app activity不是start activity
2.启动uiautomatorviewer报错:Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncExcept…
解决方法:
- 在cmd命令窗口中输入 adb root 即可;
- 重启手机无效;
- 重新把手机拔了再插;
- 重启appuim;
- 重启uiautomatorviewer.bat;
- 打开手机开发者权限,将USB调试按钮重新启动就好了;