为方便更多用户查找界面元素,提供了同时支持 Android 和 iOS 平台的 Inspector 工具,此功能也是 Macaca 录制器的重要部分。另外,Web 元素查找请直接只用 chrome-inspector
。
$ npm i app-inspector -g
$ app-inspector -u xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
更多用法和信息请参考 Macaca 文档。
欢迎讨论,互相学习。
微博: http://weibo.com/xudafeng
Github: https://github.com/xudafeng
加精理由: 完全 Web 化的 inspector, 更方便使用. 期待更好的发展
试用了一下,npm global install 报错,最后用的 local install。
对于 iOS 元素,似乎没有 UI 控件名(UIATextField 之类)?需要自己从 type 转换吗?
另外每个元素的 property 里有 accessibility id 吗?
@ccy 能麻烦提个 issue 吗,提供下你的系统版本和 node 版本
NB 的飞起呀
在安装完 macaca android 版本并成功运行用例的情况下,使用指令'npm i app-inspector -g'安装报错,提示如下。设备为 win 10 32 位:
C:\Users\client>npm i app-inspector -g
npm WARN deprecated win-spawn@2.0.0: use [cross-spawn](https://github.com/IndigoUnited/node-cross-spawn) or [cross-spawn-async](https://github.com/IndigoUnited/node-cross-spawn-async) instead.
npm WARN deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
> webdriveragent@1.0.16 install C:\Users\client\AppData\Roaming\npm\node_modules\app-inspector\node_modules\webdriveragent
> unzip -o ./WebDriverAgent.zip -d ./ 1>/dev/null
|系统找不到指定的路径。
> uiautomator-client@1.0.16 install C:\Users\client\AppData\Roaming\npm\node_modules\app-inspector\node_modules\uiautomator-client
> node ./scripts/build.js
JAVA_HOME is set to D:\Program Files\Java\jdk1.8.0_72
Updated
file C:\Users\client\AppData\Roaming\npm\node_modules\app-inspector\node_modules\uiautomator-client\build.xml
Buildfile: C:\Users\client\AppData\Roaming\npm\node_modules\app-inspector\node_modules\uiautomator-client\build.xml
-check-env:
[checkenv] Android SDK Tools Revision 25.1.7
[checkenv] Installed at D:\SoftWare\Develop\Android\SDK-build-setup:
[getbuildtools] Using latest Build Tools: 24.0.1
[echo] Resolving Build Target for uiautomator-bootstrap...
[getuitarget] Project Target: Android 6.0
[getuitarget] API level: 23
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: C:\Users\client\AppData\Roaming\npm\node_modules\app-inspector\node_modules\uiautomator-client\bin
[mkdir] Created dir: C:\Users\client\AppData\Roaming\npm\node_modules\app-inspector\node_modules\uiautomator-client\bin\classes-pre-compile:compile:
[javac] Compiling 18 source files to C:\Users\client\AppData\Roaming\npm\node_modules\app-inspector\node_modules\uiautomator-client\bin\classes
[javac] ����: [options] Դֵ1.5�ѹ�ʱ, ����δ�����з��а���ɾ��
[javac] ����: [options] Ŀ��ֵ1.5�ѹ�ʱ, ����δ�����з��а���ɾ�� [javac] ����: [options] Ҫ�����й��ѹ�ʱѡ���ľ���, ��ʹ�� -Xlint:-options��
[javac] 3 �����
�
-post-compile:
-dex:
[dex] input: C:\Users\client\AppData\Roaming\npm\node_modules\app-inspector\node_modules\uiautomator-client\bin\classes
[dex] Converting compiled files and external libraries into C:\Users\client\AppData\Roaming\npm\node_modules\app-inspector\node_modules\uiautomator-client\bin\classes.dex...
-post-dex:
-jar:
[jar] Building jar: C:\Users\client\AppData\Roaming\npm\node_modules\app-inspector\node_modules\uiautomator-client\bin\uiautomator-bootstrap.jar
-post-jar:
build:
BUILD SUCCESSFULTotal time: 6 seconds
uiautomator-bootstrap build success!
npm WARN optional dep failed, continuing fsevents@1.0.14
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i" "app-inspector" "-g"
npm ERR! node v4.4.7
npm ERR! npm v2.15.8
npm ERR! code ELIFECYCLE
npm ERR! webdriveragent@1.0.16 install: `unzip -o ./WebDriverAgent.zip -d ./ 1>/dev/null`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the webdriveragent@1.0.16 install script 'unzip -o ./WebDriverAgent.zip -d ./ 1>/dev/null'.
npm ERR! This is most likely a problem with the webdriveragent package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! unzip -o ./WebDriverAgent.zip -d ./ 1>/dev/null
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs webdriveragent
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls webdriveragent
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\client\npm-debug.log
抱歉,没有考虑 webdriveragent 模块在 win 下的不兼容问题,已修复请重装
windows 用户参考这篇 https://testerhome.com/topics/5626
为什么会一直显示等待链接设备呢