序言:
mark下搭建macaca app-inpector环境的步骤
开始正文:
iOS篇
1.安装Xcode:从Appstore下载即可
2.安装brew:
安装教程:https://brew.sh/index_zh-cn.html
3.安装carthage:
brew install carthage #这个将在 /Users/用户名/Library/Developer/Xcode/DerivedData生成项目,不能移除
4.安装Node.js(检查node -v,npm -v,如果没有则进行安装,安装成功后,本机后续安装路径选择了usr/local/lib)
brew install node
npm install -g cnpm -registry=https://registry.npm.taobao.org #国内访问外网比较困难,需要切换到淘宝源
5.安装macaca-cli
cnpm install macaca-cli -g
例如:S7D5Q8QNKF
真机安装:
DEVELOPMENT_TEAM_ID=S7D5Q8QNKF cnpm i app-inspector -g #绑定TEAM_ID才能对真机生效
模拟器安装:
cnpm i app-inspector -g
7.进入/usr/local/lib/node_modules/app-inspector/node_modules/[email protected]@xctestwd/XCTestWD
将XCTestWD.xcodeproj重签名
8.获取设备号并运用:
模拟器:
xcrun simctl list
真机:
通过iTunes获取UDID
(例如这样的串:59fe1096fcea390c2900c6d75ec72b5baf21f721)
使用的命令:app-inspector -u YOUR-DEVICE-ID
app-inspector -u 59fe1096fcea390c2900c6d75ec72b5baf21f721
9.获取元素
Android篇
1.安装brew
安装教程:https://brew.sh/index_zh-cn.html
2.安装Node.js(检查node -v,npm -v,如果没有则进行安装,本机安装的路径是user/local/lib)
brew install node
npm install -g cnpm -registry=https://registry.npm.taobao.org #国内访问外网比较困难,需要切换到淘宝源
3.安装macaca-cli
cnpm install macaca-cli -g
4.设置JAVA_HOME
open ~/.bash_profile
#增加:
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
export JAVA_HOME
5.设置ANDROID_HOME
open ~/.bash_profile
#增加:
ANDROID_HOME=/Users/longchen/work/android-sdk-macosx
export ANDROID_HOME
6.Android SDK中下载依赖
Tools->Android SDK Tools,Android SDK Platform-tools;
Extras->Android Support Repository,Android Support Library;
7.安装gradle
brew install gradle
8.安装app-inspector,如果真机调试过程中失败,再进行一次
cnpm i app-inspector -g
9.获取设备号并运行
通过adb devices获取设备号(例如这样的串:812f797d)
使用的命令:app-inspector -u YOUR-DEVICE-ID
app-inspector -u 812f797d —verbose
10.获取元素