Macaca win10 macaca app-inspector 安装使用记

小马 · 2016年08月08日 · 最后由 wywy 回复于 2019年05月15日 · 401 次阅读

今天发现 Macaca 团队发布了,基于 macaca 的 inspector 赶紧安装起来看看吧。
http://macacajs.github.io/macaca/inspector.html

一 开始命令行安装 app-inspector

不多说,根据帮助开启 win10 cmd 命令行 开始安装。前提是你已经要部署好 macaca-cli 。

C:\Users\cmd>npm i app-inspector -g
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
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
D:\nodejs\node-global\inspector -> D:\nodejs\node-global\node_modules\app-inspector\bin\app-inspector
D:\nodejs\node-global\app-inspector -> D:\nodejs\node-global\node_modules\app-inspector\bin\app-inspector

> webdriveragent@1.0.19 install D:\nodejs\node-global\node_modules\app-inspector\node_modules\webdriveragent
> node ./scripts/install.js


> uiautomator-client@1.0.16 install D:\nodejs\node-global\node_modules\app-inspector\node_modules\uiautomator-client
> node ./scripts/build.js

JAVA_HOME is set to C:\Program Files\Java\jdk1.8.0_91
Updated file
D:\nodejs\node-global\node_modules\app-inspector\node_modules\uiautomator-client\build.xml

Buildfile: D:\nodejs\node-global\node_modules\app-inspector\node_modules\uiautomator-client\build.xml
-check-env:
 [checkenv] Android SDK Tools Revision 25.1.7
 [checkenv] Installed at D:\Android\android-sdk-windows-build-setup:
[getbuildtools] Using latest Build Tools: 23.0.2
     [echo] Resolving Build Target for uiautomator-bootstrap...
[getuitarget] Project Target:   Android 7.0
[getuitarget] API level:        24
     [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: D:\nodejs\node-global\node_modules\app-inspector\node_modules\uiautomator-client\bin
    [mkdir] Created dir: D:\nodejs\node-global\node_modules\app-inspector\node_modules\uiautomator-client\bin\classes
-pre-compile:compile:
    [javac] Compiling 18 source files to D:\nodejs\node-global\node_modules\app-inspector\node_modules\uiautomator-client\bin\classes
    [javac] ����: [options] Դֵ1.5�ѹ�ʱ, ����δ�����з��а���ɾ��
    [javac] ����: [options] Ŀ��ֵ1.5�ѹ�ʱ, ����δ�����з��а���ɾ��    [javac] ����: [options] Ҫ�����й��ѹ�ʱѡ���ľ���, ��ʹ�� -Xlint:-options��
    [javac] ע: ijЩ�����ļ�ʹ�û�����ѹ�ʱ�� API��
    [javac] ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:deprecation ���±��롣
    [javac] 3 ������-post-compile:-dex:
      [dex] input: D:\nodejs\node-global\node_modules\app-inspector\node_modules\uiautomator-client\bin\classes
      [dex] Converting compiled files and external libraries into D:\nodejs\node-global\node_modules\app-inspector\node_modules\uiautomator-client\bin\classes.dex...
-post-dex:
-jar:
      [jar] Building jar: D:\nodejs\node-global\node_modules\app-inspector\node_modules\uiautomator-client\bin\uiautomator-bootstrap.jar
-post-jar:
build:
BUILD SUCCESSFULTotal time: 3 seconds
uiautomator-bootstrap build success!
D:\nodejs\node-global
`-- app-inspector@1.0.8
  +-- babel@5.6.23
  | +-- babel-core@5.8.38
  | | +-- babel-plugin-constant-folding@1.0.1
  | | +-- babel-plugin-dead-code-elimination@1.0.2
  | | +-- babel-plugin-eval@1.0.1
  | | +-- babel-plugin-inline-environment-variables@1.0.1
  | | +-- babel-plugin-jscript@1.0.4
  | | +-- babel-plugin-member-expression-literals@1.0.1
  | | +-- babel-plugin-property-literals@1.0.1
  | | +-- babel-plugin-proto-to-assign@1.0.4
  | | +-- babel-plugin-react-constant-elements@1.0.3
  | | +-- babel-plugin-react-display-name@1.0.3
  | | +-- babel-plugin-remove-console@1.0.1
  | | +-- babel-plugin-remove-debugger@1.0.1
  | | +-- babel-plugin-runtime@1.0.7
  | | +-- babel-plugin-undeclared-variables-check@1.0.2
  | | | `-- leven@1.0.2
  | | +-- babel-plugin-undefined-to-void@1.1.6
  | | +-- babylon@5.8.38
  | | +-- bluebird@2.10.2
  | | +-- core-js@1.2.7
  | | +-- detect-indent@3.0.1
  | | | +-- get-stdin@4.0.1
  | | | `-- minimist@1.2.0
  | | +-- esutils@2.0.2
  | | +-- globals@6.4.1
  | | +-- home-or-tmp@1.0.0
  | | | +-- os-tmpdir@1.0.1
  | | | `-- user-home@1.1.1
  | | +-- is-integer@1.0.6
  | | | `-- is-finite@1.0.1
  | | |   `-- number-is-nan@1.0.0
  | | +-- js-tokens@1.0.1
  | | +-- json5@0.4.0
  | | +-- minimatch@2.0.10
  | | | `-- brace-expansion@1.1.6
  | | |   +-- balanced-match@0.4.2
  | | |   `-- concat-map@0.0.1
  | | +-- private@0.1.6
  | | +-- regenerator@0.8.40
  | | | +-- commoner@0.10.4
  | | | | +-- detective@4.3.1
  | | | | | +-- acorn@1.2.2
  | | | | | `-- defined@1.0.0
  | | | | `-- q@1.4.1
  | | | +-- defs@1.1.1
  | | | | +-- alter@0.2.0
  | | | | | `-- stable@0.1.5
  | | | | +-- ast-traverse@0.1.1
  | | | | +-- breakable@1.0.0
  | | | | +-- simple-fmt@0.1.0
  | | | | +-- simple-is@0.2.0
  | | | | +-- stringmap@0.2.2
  | | | | +-- stringset@0.2.1
  | | | | +-- tryor@0.1.2
  | | | | `-- yargs@3.27.0
  | | | |   +-- camelcase@1.2.1
  | | | |   +-- cliui@2.1.0
  | | | |   | +-- center-align@0.1.3
  | | | |   | | +-- align-text@0.1.4
  | | | |   | | | `-- longest@1.0.1
  | | | |   | | `-- lazy-cache@1.0.4
  | | | |   | +-- right-align@0.1.3
  | | | |   | `-- wordwrap@0.0.2
  | | | |   +-- decamelize@1.2.0
  | | | |   +-- os-locale@1.4.0
  | | | |   | `-- lcid@1.0.0
  | | | |   |   `-- invert-kv@1.0.0
  | | | |   +-- window-size@0.1.4
  | | | |   `-- y18n@3.2.1
  | | | +-- esprima-fb@15001.1001.0-dev-harmony-fb
  | | | +-- recast@0.10.33
  | | | | +-- ast-types@0.8.12
  | | | | `-- source-map@0.5.6
  | | | `-- through@2.3.8
  | | +-- regexpu@1.3.0
  | | | +-- esprima@2.7.2
  | | | +-- regenerate@1.3.1
  | | | +-- regjsgen@0.2.0
  | | | `-- regjsparser@0.1.5
  | | |   `-- jsesc@0.5.0
  | | +-- repeating@1.1.3
  | | +-- resolve@1.1.7
  | | +-- shebang-regex@1.0.0
  | | +-- source-map@0.5.6
  | | +-- source-map-support@0.2.10
  | | | `-- source-map@0.1.32
  | | +-- to-fast-properties@1.0.2
  | | +-- trim-right@1.0.1
  | | `-- try-resolve@1.0.1
  | +-- chokidar@1.6.0
  | | +-- anymatch@1.3.0
  | | | +-- arrify@1.0.1
  | | | `-- micromatch@2.3.11
  | | |   +-- arr-diff@2.0.0
  | | |   | `-- arr-flatten@1.0.1
  | | |   +-- array-unique@0.2.1
  | | |   +-- braces@1.8.5
  | | |   | +-- expand-range@1.8.2
  | | |   | | `-- fill-range@2.2.3
  | | |   | |   +-- is-number@2.1.0
  | | |   | |   +-- isobject@2.1.0
  | | |   | |   +-- randomatic@1.1.5
  | | |   | |   `-- repeat-string@1.5.4
  | | |   | +-- preserve@0.2.0
  | | |   | `-- repeat-element@1.1.2
  | | |   +-- expand-brackets@0.1.5
  | | |   | `-- is-posix-bracket@0.1.1
  | | |   +-- extglob@0.3.2
  | | |   +-- filename-regex@2.0.0
  | | |   +-- kind-of@3.0.4
  | | |   | `-- is-buffer@1.1.4
  | | |   +-- normalize-path@2.0.1
  | | |   +-- object.omit@2.0.0
  | | |   | +-- for-own@0.1.4
  | | |   | | `-- for-in@0.1.5
  | | |   | `-- is-extendable@0.1.1
  | | |   +-- parse-glob@3.0.4
  | | |   | +-- glob-base@0.3.0
  | | |   | `-- is-dotfile@1.0.2
  | | |   `-- regex-cache@0.4.3
  | | |     +-- is-equal-shallow@0.1.3
  | | |     `-- is-primitive@2.0.0
  | | +-- async-each@1.0.0
  | | +-- glob-parent@2.0.0
  | | +-- inherits@2.0.1
  | | +-- is-binary-path@1.0.1
  | | | `-- binary-extensions@1.5.0
  | | +-- is-glob@2.0.1
  | | | `-- is-extglob@1.0.0
  | | `-- readdirp@2.1.0
  | |   +-- minimatch@3.0.2
  | |   +-- readable-stream@2.1.4
  | |   | `-- buffer-shims@1.0.0
  | |   `-- set-immediate-shim@1.0.1
  | +-- convert-source-map@1.3.0
  | +-- fs-readdir-recursive@0.1.2
  | +-- glob@5.0.15
  | | +-- inflight@1.0.5
  | | | `-- wrappy@1.0.2
  | | `-- once@1.3.3
  | +-- lodash@3.10.1
  | +-- output-file-sync@1.1.2
  | | `-- graceful-fs@4.1.5
  | +-- path-exists@1.0.0
  | +-- path-is-absolute@1.0.0
  | +-- slash@1.0.0
  | `-- source-map@0.4.4
  |   `-- amdefine@1.0.0
  +-- chalk@1.1.3
  | +-- ansi-styles@2.2.1
  | +-- escape-string-regexp@1.0.5
  | +-- has-ansi@2.0.0
  | | `-- ansi-regex@2.0.0
  | +-- strip-ansi@3.0.1
  | `-- supports-color@2.0.0
  +-- co@4.6.0
  +-- co-request@1.0.0
  +-- commander@2.9.0
  | `-- graceful-readlink@1.0.1
  +-- detect-port@1.0.0
  | `-- commander@2.8.1
  +-- ios-simulator@1.0.7
  | `-- plist@1.2.0
  |   +-- base64-js@0.0.8
  |   +-- util-deprecate@1.0.2
  |   +-- xmlbuilder@4.0.0
  |   `-- xmldom@0.1.22
  +-- koa@1.2.1
  | +-- accepts@1.3.3
  | | `-- negotiator@0.6.1
  | +-- composition@2.3.0
  | | `-- any-promise@1.3.0
  | +-- content-disposition@0.5.1
  | +-- content-type@1.0.2
  | +-- cookies@0.6.1
  | | +-- depd@1.1.0
  | | `-- keygrip@1.0.1
  | +-- debug@2.2.0
  | | `-- ms@0.7.1
  | +-- delegates@1.0.0
  | +-- destroy@1.0.4
  | +-- error-inject@1.0.0
  | +-- escape-html@1.0.3
  | +-- fresh@0.3.0
  | +-- http-assert@1.2.0
  | | +-- deep-equal@1.0.1
  | | `-- http-errors@1.4.0
  | +-- http-errors@1.5.0
  | | `-- setprototypeof@1.0.1
  | +-- koa-compose@2.4.0
  | +-- koa-is-json@1.0.0
  | +-- mime-types@2.1.11
  | | `-- mime-db@1.23.0
  | +-- on-finished@2.3.0
  | | `-- ee-first@1.1.1
  | +-- only@0.0.2
  | +-- parseurl@1.3.1
  | +-- statuses@1.3.0
  | +-- type-is@1.6.13
  | | `-- media-typer@0.3.0
  | `-- vary@1.1.0
  +-- koa-bodyparser@2.2.0
  | +-- co-body@4.2.0
  | | +-- inflation@2.0.0
  | | +-- qs@4.0.0
  | | `-- raw-body@2.1.7
  | |   +-- bytes@2.4.0
  | |   +-- iconv-lite@0.4.13
  | |   `-- unpipe@1.0.0
  | `-- copy-to@2.0.1
  +-- koa-router@5.4.0
  | +-- methods@1.1.2
  | `-- path-to-regexp@1.5.3
  |   `-- isarray@0.0.1
  +-- koa-static@2.0.0
  | `-- koa-send@3.1.1
  |   +-- mz@2.4.0
  |   | `-- thenify-all@1.6.0
  |   |   `-- thenify@3.2.0
  |   `-- resolve-path@1.3.2
  +-- macaca-adb@1.0.17
  | `-- macaca-utils@0.1.8
  +-- npm-update@1.0.2
  | `-- co-request@0.2.1
  +-- react@15.3.0
  | +-- fbjs@0.8.3
  | | +-- immutable@3.8.1
  | | +-- isomorphic-fetch@2.2.1
  | | | +-- node-fetch@1.6.0
  | | | | +-- encoding@0.1.12
  | | | | `-- is-stream@1.1.0
  | | | `-- whatwg-fetch@1.0.0
  | | +-- promise@7.1.1
  | | | `-- asap@2.0.4
  | | `-- ua-parser-js@0.7.10
  | +-- loose-envify@1.2.0
  | `-- object-assign@4.1.0
  +-- react-dom@15.3.0
  +-- request@2.74.0
  | +-- aws-sign2@0.6.0
  | +-- aws4@1.4.1
  | +-- bl@1.1.2
  | | `-- readable-stream@2.0.6
  | |   +-- core-util-is@1.0.2
  | |   +-- isarray@1.0.0
  | |   +-- process-nextick-args@1.0.7
  | |   `-- string_decoder@0.10.31
  | +-- caseless@0.11.0
  | +-- combined-stream@1.0.5
  | | `-- delayed-stream@1.0.0
  | +-- extend@3.0.0
  | +-- forever-agent@0.6.1
  | +-- form-data@1.0.0-rc4
  | | `-- async@1.5.2
  | +-- har-validator@2.0.6
  | | +-- is-my-json-valid@2.13.1
  | | | +-- generate-function@2.0.0
  | | | +-- generate-object-property@1.2.0
  | | | | `-- is-property@1.0.2
  | | | +-- jsonpointer@2.0.0
  | | | `-- xtend@4.0.1
  | | `-- pinkie-promise@2.0.1
  | |   `-- pinkie@2.0.4
  | +-- hawk@3.1.3
  | | +-- boom@2.10.1
  | | +-- cryptiles@2.0.5
  | | +-- hoek@2.16.3
  | | `-- sntp@1.0.9
  | +-- http-signature@1.1.1
  | | +-- assert-plus@0.2.0
  | | +-- jsprim@1.3.0
  | | | +-- extsprintf@1.0.2
  | | | +-- json-schema@0.2.2
  | | | `-- verror@1.3.6
  | | `-- sshpk@1.9.2
  | |   +-- asn1@0.2.3
  | |   +-- assert-plus@1.0.0
  | |   +-- dashdash@1.14.0
  | |   | `-- assert-plus@1.0.0
  | |   +-- ecc-jsbn@0.1.1
  | |   +-- getpass@0.1.6
  | |   | `-- assert-plus@1.0.0
  | |   +-- jodid25519@1.0.2
  | |   +-- jsbn@0.1.0
  | |   `-- tweetnacl@0.13.3
  | +-- is-typedarray@1.0.0
  | +-- isstream@0.1.2
  | +-- json-stringify-safe@5.0.1
  | +-- node-uuid@1.4.7
  | +-- oauth-sign@0.8.2
  | +-- qs@6.2.1
  | +-- stringstream@0.0.5
  | +-- tough-cookie@2.3.1
  | `-- tunnel-agent@0.4.3
  +-- uiautomator-client@1.0.16
  | +-- ant-lite@1.0.1
  | +-- java-home@1.0.2
  | `-- win-spawn@2.0.0
  +-- webdriveragent@1.0.19
  | `-- adm-zip@0.4.7
  +-- xctest-client@1.0.17
  | +-- ios-utils@1.0.1
  | | `-- bplist-parser@0.1.1
  | |   `-- big-integer@1.6.15
  | +-- request@2.69.0
  | | +-- bl@1.0.3
  | | | `-- readable-stream@2.0.6
  | | +-- qs@6.0.2
  | | `-- tough-cookie@2.2.2
  | `-- webdriver-dfn-error-code@1.0.3
  +-- xlogger@1.0.4
  +-- xml2map@1.0.2
  | +-- sax@0.4.2
  | `-- xml-writer@1.6.0
  `-- xutil@1.0.1
    +-- ipv4@0.0.4
    +-- mkdirp@0.5.1
    | `-- minimist@0.0.8
    +-- moment@2.10.6
    `-- rimraf@2.5.4
      `-- glob@7.0.5
        +-- fs.realpath@1.0.0
        `-- minimatch@3.0.2

npm WARN optional Skipping failed optional dependency /app-inspector/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14

如此日志便说明 app-inspector 安装成功了。
C:\Users\cmd>app-inspector -v
1.0.8

二 启动 avd 模拟器 或 Genymotion 模拟器

https://github.com/xudafeng/app-inspector

我启动的是 Genymotion 模拟器,然后执行 adb devices -l 命令找到设备 udid 如果是虚拟器的话 udid 实际是 ip:port 形式。
C:\Users\cmd>adb devices -l
List of devices attached
192.168.236.101:5555 device product:vbox86p model:Samsung_Galaxy_S6_5_1_0API_22__1440x2560 device:vbox86p

三 开始 inspect 吧

C:\Users\cmd>app-inspector -u 192.168.236.101:5555
 inspector start at: http://*.*.*.*:5678
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stream=
com.android.uiautomator.client.Initialize:
INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner

INSTRUMENTATION_STATUS: test=testStartServer
INSTRUMENTATION_STATUS: class=com.android.uiautomator.client.Initialize
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS_CODE: 1
uiautomator start socket server.

socket server ready
socket client ready

根据日志 发现 该行 inspector start at: http://...:5678

发现居然是个外网 IP 我以为应该是和 udid 一样的 IP 192.168.236.101:5555 可惜不是,所以我用... 来代替下。

新开个谷歌浏览器,输入该地址 http://...:5678 回车。
接下来 你就可以 打开那个示例程序 Android Bootstrap 操作几下,效果如下图,在浏览器里就 inspect 到 UI 元素了。

更多信息请参考 wiki 汇总

小马的 macaca 入门指引合集

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
共收到 42 条回复 时间 点赞
xdf [该话题已被删除] 中提及了此贴 08月08日 09:44
小马 [该话题已被删除] 中提及了此贴 08月09日 10:55

请问这个只能按 xpath 进行定位吗?

是的,其他选择器要手动写

C:\Users\Administrator>app-inspector -v

C:\Program Files (x86)\Appium\node_modules\app-inspector\bin\app-inspector:5
const co = require('co');
^^^^^
SyntaxError: Use of const in strict mode.
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3

C:\Users\Administrator>node -v
v0.10.26

不知道怎么整了。。。win7 64bit 系统。。。。

#5 楼 @huangke "前提是你已经要部署好 macaca-cli "
执行 macaca -v 正常吗

macaca doctor 报错了吗?

C:\Users\Administrator>node -v
v0.10.26

你的 node 怎么是这样的版本号.请参考https://testerhome.com/topics/5483 安装 node npm 等

#6 楼 @harsayer 我部署好了环境,macaca doctor 检测也没报错(我只测 iOS,Android 相关的两项没安装),但是运行 app-inspector -u UDID 时(模拟器),报错如下:

>> port: 5678 was occupied, changed port: 5679
>> WebDriverAgent version: 1.0.28
>> iOS device started: F7BF2FD0-6458-4CA1-8E25-FF17E971E20E
>> inspector start at: http://192.168.44.128:5679
  <-- GET /

  Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/app-inspector/.temp'
      at Error (native)
      at Object.fs.mkdirSync (fs.js:794:18)
      at Object.sync [as mkdir] (/usr/local/lib/node_modules/app-inspector/node_modules/mkdirp/index.js:71:13)
      at Object.exports.dumpXMLAndScreenShot (/usr/local/lib/node_modules/app-inspector/lib/ios.js:56:5)
      at next (native)
      at onFulfilled (/usr/local/lib/node_modules/app-inspector/node_modules/co/index.js:65:19)
      at process._tickCallback (node.js:369:9)

浏览器页面也打不开,提示: Internal Server Error。这是什么原因呢?求指导

#7 楼 @wanwan001 mac 系统环境的吗? 启动 URL 是 http://192.168.44.128:5679 看日志.
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/app-inspector/.temp' 看日志是权限问题啊.

如果是 mac 或 ubuntu 类 linux 注意安装部署时候的账号 以及安装后目录的权限 一般我都是 chown -R 用户组:用户 都改成当前登陆账号的.

#8 楼 @harsayer 对的,我在 MAC 系统上操作。我也考虑过权限问题,用 sudo app-inspector -u UDID 命令运行过,运行时输出这两行后就运行不动了......

>> port: 5678 was occupied, changed port: 5679
>> WebDriverAgent version: 1.0.28
小马 #10 · 2016年10月11日 Author

#9 楼 @wanwan001 去掉 sudo 试试

#10 楼 @harsayer 去掉 sudo 报 7 楼的错误。昨天看了一个帖子,sudo 不是随随便能用的,可能需要重装 npm 之类的...

安装成功提示 automation 报错,需要装 UIautomation-clent 们

小马 #13 · 2016年10月12日 Author

#12 楼 @luobs 前提是你已经要部署好 macaca-cli 。我可能说写漏了 除了 macaca-cli 安装 inspector 之前
可能还需要 macaca-chrome macaca-android macaca-ios 等驱动. 那里边有 uiautomator 吧

你试试.

另 我安装 inspector 时候 会假性安装成功 就是安装完启动就报各种错 实际就是没安装对.
你可以 npm uninstall *** -g
在 npm cache clean 后
在 npm i *** -g 重新安装 再启动 inspector 多试几次

我看我当初安装日志

uiautomator-client@1.0.16 install D:\nodejs\node-global\node_modules\app-inspector\node_modules\uiautomator-client

inspector 带 uiautomator 的啊 不过这东西容易安装失败 因为我想起来好像比较大

Gavin [该话题已被删除] 中提及了此贴 10月18日 10:59
Gavin Appium 1.6 ios 无缝升级 中提及了此贴 11月19日 16:34

你好,我环境配置好,跟着运行了 app-inspector -u(模拟器)的命令,链接正常

>> Android device started: 192.168.56.101:5555
>> inspector start at: http://172.17.11.130:5678

进入到http://172.17.11.130:5678
终端上看链接没有断,但是 GET 到的页面是 404,一片空白

>> Dump Android XML success, save to /usr/local/lib/node_modules/app-inspector/.temp/android.json
--> GET / 200
<-- GET /dist/index.js
--> GET /dist/index.js 404

请问一下这样是什么情况,有什么解决方法吗?

小马 #17 · 2016年11月22日 Author

#16 楼 @micky_jw 什么平台 mac 的?
app-inspector -v
macaca -v
macaca doctor

adb devices -l 都执行检查下

用的什么浏览器访问的?

#17 楼 @harsayer 你好,我用的 chrome;也用了 safari 查看过。因为 404.效果是一样的

`
app-inspector -v

1.2.15

macaca -v

1.1.16

macaca doctor

macaca-doctor version: 1.0.27

Node.js checklist:

node env: /usr/local/bin/node
node version: v6.7.0

iOS checklist:

Xcode is installed at: /Applications/Xcode.app/Contents/Developer
Xcode Command Line Tools is ready, version: 2343.
iproxy[usbmuxd] is installed at: /usr/local/bin/iproxy
ios_webkit_debug_proxy is installed at: /usr/local/bin/ios_webkit_debug_proxy

Android checklist:

JAVA version is 1.8.0_91
JAVA_HOME is set to /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
ANDROID_HOME is set to /Users/micky/Library/Android/sdk
Platforms is set to /Users/micky/Library/Android/sdk/platforms/android-24
Android tools is set to /Users/micky/Library/Android/sdk/tools/android
ADB tool is set to /Users/micky/Library/Android/sdk/platform-tools/adb

Installed driver list:

android: 1.1.1
chrome: 1.0.4
ios: 1.0.42
`

小马 #19 · 2016年11月23日 Author

#18 楼 @micky_jw sorry mac 平台的话 我涉及不多。但社区里好像有人也说过 app-inspector 在 mac 平台上的问题的解决帖子。
你可以自行找找,但主题不叫 app-inspector 之类的 你搜 mac 平台之类的关键词吧。

#19 楼 @harsayer 好的~我再搜着研究一下

22楼 已删除

@harsayer 用的 iOS 真机,启动:app-inspector -u bb1f6c5abfef652ef6b087f434acb8de105b90d4,报错:

xctest-client start with port: 8900
WebDriverAgent version: 1.0.41
app-inspector:66:44 [master] pid:10034 undefined
(node:10034) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: >> app-inspector:66:44 [master] pid:10034 undefined
(node:10034) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
不知道是哪里出错了,求助~

安装 app-inspector 的时候,build inspector 老是失败

小马 #25 · 2017年01月17日 Author

#24 楼 @lynn_qin 我这儿妥妥的啊 刚将 nodejs 升级到 6.9.4 又重新折腾了一遍 啥都好好的啊 你按套路安装啊 https://testerhome.com/wiki/macaca 这里的都看一下

是按照这个上面来的

小马 #27 · 2017年01月17日 Author

#26 楼 @lynn_qin *** *** 吧 你在好的网络下 一切都有

@harsayer 小马,用来定位 H5 页面的话,xpath 每次都会变……class 和 name 没有的情况下怎么破

29楼 已删除
小马 #30 · 2017年02月21日 Author

#28 楼 @clergychen IOS 下的元素确实是动态的 可参考该文 让开发打包该小组件 https://testerhome.com/topics/6642 不过 h5 不是动态的吧 除非你们开发实现的页面效果是用的动态的

安装完启动报以下错误,是什么情况啊

小马 #32 · 2017年02月21日 Author

#29 楼 @dxw1986 卸载掉重装 npm uninstall app-inspector -g

npm cache clean
npm i app-inspector -g 最好连自己的手机 4g 热点 电信网络下载某些底层依赖组件
app-inspector\node_modules\webdriveragent 或 app-inspector\node_modules\uiautomator-clien 会卡 要么会假告诉你安装成功。

小马 回复


请教,这是什么原因?由于电脑系统重装了,重搭环境,之前系统 app-inspector 都可以正常跑,
反复按你说的 uninstall &clean,再重装,macaca doctor 都是正常的。

小马 #34 · 2017年03月27日 Author
小王子 回复

1 检查下你的 Nodejs 安装路径 不要安装到含有 (x86) 此类或中文目录下 2 检查下你的 android sdk 安装配置

小马 回复

感谢小马,已解决!我去😂 😂 ,还真是(x86)目录这个原因,踩到坑了!


  • version 1.2.15 is outdate *
  • run: npm i -g app-inspector@1.2.20 * **************************************** 运行命令行,升级报错:
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
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 node-uuid@1.4.7: Use uuid module instead
npm WARN deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "app-inspector" "-g" "--registry=https://registry.npm.taobao.org"
npm ERR! node v6.7.0
npm ERR! npm  v3.10.9
npm ERR! path /usr/local/lib/node_modules/app-inspector/node_modules/webdriveragent
npm ERR! code EISGIT

npm ERR! git /usr/local/lib/node_modules/app-inspector/node_modules/webdriveragent: Appears to be a git repo or submodule.
npm ERR! git     /usr/local/lib/node_modules/app-inspector/node_modules/webdriveragent
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.
小马 #37 · 2017年03月28日 Author
MJW 回复

你装一个工具 npm-check

安装命令 npm i npm-check -g 安装好后用 npm-check -u -g 来检查升级 macaca 相关 我看你是用 npm i 来覆盖安装升级的.

小马 回复

好的,感谢

小王子 回复

我的跟你一样,但是我没安装在 x86 下,就是安装在 C:\Program Files\nodejs

付兰 回复

老老实实安装到其他路径吧,例如 D:\nodejs,最好别安装到 C 盘。

我这边 inspector 安装完后报这个错,问下有什么处理方法

小马 #42 · 2017年04月27日 Author
john 回复

uiautomator-client 提示你 这个没找到。 你安装的时候,网络条件不好的时候,这个组件很大 几十 MB 吧 有时候 实际没下载完全 可又提示你安装成功,这是会经常遇见的情况。 建议重新卸载安装。
npm uninstall app-inspector -g
npm cache clean
再清理下 如果你是 win10 C:\Users\your name\AppData\Local\Temp 目录 npm 相关都删掉。
再 npm i app-inspector -g

网络条件很重要,找个靠谱的 *** 或国外代理 或者 fan qiang 或者你开手机 4G(中国移动最好)热点 让你的 win10 只连接该热点 wifi ,再执行 npm i

用 *** 移动 4g 热点全都报错
Invalid or unsupported command "create uitest-project -n uiautomator-bootstrap -t android-24 -p ."
Supported commands are:
android list target
android list avd
android list device
android create avd
android move avd
android delete avd
android list sdk
android update sdk
/usr/local/lib/node_modules/app-inspector/node_modules/uiautomator-client/scripts/build.js:177
throw e;
^

Error: setup failed
at ChildProcess.createProcess.on.code (/usr/local/lib/node_modules/app-inspector/node_modules/uiautomator-client/scripts/build.js:133:16)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
/usr/local/lib

win7 能装 app-inspector 吗


请问我这个问题应该怎么解决呢,打开浏览器后就显示 Internal Server Error,而且我的 webdriveragent 里面没有那个 usb 的驱动

你好,辛苦帮忙看下 win10 启动 app-inspector 报错,以下是报错信息。

Microsoft Windows [版本 10.0.15063]
(c) 2017 Microsoft Corporation。保留所有权利。

C:\Users\KingDow>adb devices -l
List of devices attached
192.168.189.101:5555   device product:vbox86p model:Genymotion__Phone__version device:vbox86p


C:\Users\KingDow>app-inspector -u 192.168.189.101:5555
{ Error: Command failed: E:\autoTest\macaca\tools\android-sdk-windows/platform-tools/adb -s 192.168.189.101:5555 push C:\Users\KingDow\AppData\Roaming\npm\node_modules\app-inspector\node_modules\_uiautomatorwd@1.0.42@uiautomatorwd\app\build\outputs\apk\app-debug.apk /data/local/tmp/com.macaca.android.testing

    at ChildProcess.exithandler (child_process.js:270:12)
    at emitTwo (events.js:125:13)
    at ChildProcess.emit (events.js:213:7)
    at maybeClose (internal/child_process.js:921:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
  killed: false,
  code: 1,
  signal: null,
  cmd: 'E:\\autoTest\\macaca\\tools\\android-sdk-windows/platform-tools/adb -s 192.168.189.101:5555 push C:\\Users\\KingDow\\AppData\\Roaming\\npm\\node_modules\\app-inspector\\node_modules\\_uiautomatorwd@1.0.42@uiautomatorwd\\app\\build\\outputs\\apk\\app-debug.apk /data/local/tmp/com.macaca.android.testing' }

以下是软件的安装信息以及版本:

Microsoft Windows [版本 10.0.15063]
(c) 2017 Microsoft Corporation。保留所有权利。

C:\Users\KingDow>macaca -v

  2.0.9


C:\Users\KingDow>app-inspector -v

 2.0.6


C:\Users\KingDow>macaca doctor

  macaca-doctor version: 2.0.2


  Node.js checklist:

  node env: C:\Program Files\nodejs\node.exe
  node version: v8.2.1

  Android checklist:

  JAVA version is `1.8.0_141`
  JAVA_HOME is set to `E:\WORKTOOLS\jdk\jdk-8u141-windows-x64`
  ANDROID_HOME is set to `E:\autoTest\macaca\tools\android-sdk-windows`
  Platforms is set to `E:\autoTest\macaca\tools\android-sdk-windows\platforms\android-22`
  ADB tool is set to `E:\autoTest\macaca\tools\android-sdk-windows\platform-tools\adb.exe`
  GRADLE_HOME is set to `E:\autoTest\macaca\tools-new\gradle\gradle-4.0.1`

  Installed driver list:

  android: 2.0.30 [out-of-date]
  chrome: 1.0.6
  electron: 1.1.7 [out-of-date]
  ios: 2.0.22 [out-of-date]

C:\Users\KingDow>

Macaca Inspector 升级 2.0.15 https://testerhome.com/topics/12419

hi~ 想问一下在检查元素过程中,手机和电脑是通过数据线链接的么?我app-inspector -u ip:port只有在接数据线的情况下才能获取到元素信息,拔掉数据项就不行了..有没有什么办法可以不用数据线进行 app-inspector 么?


想问一下,这个是什么原因,怎么解决

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册