1、安裝
*不需要真機(jī)
$ npm install app-inspector -g
*需要真機(jī)
$ DEVELOPMENT_TEAM_ID=TEAM_ID npm i app-inspector -g
2俐筋、iOS真機(jī)牵素,獲取TEAM_ID
3、啟動(dòng)
$ app-inspector -u YOUR-DEVICE-ID
輸入命令后澄者,啟動(dòng)成功后會(huì)自動(dòng)打開瀏覽器:
如何獲取設(shè)備ID笆呆,可參考如下網(wǎng)址:http://www.reibang.com/p/e56d6f3c9b8f
備注:
當(dāng)我想要查看android的元素時(shí),出現(xiàn)下面的錯(cuò)誤:
:~ xxxx$ app-inspector -u XXXXXXX
{ Error: Command failed: /Users/xxxx/android-sdk/platform-tools/adb -s XXXXXX push /usr/local/lib/node_modules/app-inspector/node_modules/uiautomatorwd/app/build/outputs/apk/app-debug.apk /data/local/tmp/com.macaca.android.testing
報(bào)錯(cuò)信息中粱挡,說需要將debug.apk安裝包赠幕,push到手機(jī)端,然而當(dāng)我找到/usr/local/lib/node_modules/app-inspector/node_modules/uiautomatorwd/app/build/目錄的時(shí)候询筏,根本沒有對(duì)應(yīng)的文件榕堰,在Testerhome找到了解決方法:
https://testerhome.com/topics/8605
但是當(dāng)我執(zhí)行完所以的命令后,在macaca-android 找到了對(duì)應(yīng)的文件屈留,索性直接把build文件復(fù)制到app-inspector下局冰,就可以了