Macaca [公告] App Inspector 重磅升级

达峰的夏天 · 2016年08月29日 · 最后由 youhuiyun.net 回复于 2019年09月24日 · 4165 次阅读
本帖已被设为精华帖!

App Inspector 是运行在浏览器端的移动设备 UI 查看器,使用树状态结构查看 UI 布局,并且能自动生成 XPath,方便脚本的编写和生成。

安装

$ npm install app-inspector -g

使用

$ app-inspector -u YOUR-DEVICE-ID

相关链接

共收到 119 条回复 时间 点赞

好东西

启动了。游览器一直显示 Waiting Device start...


恒温 将本帖设为了精华贴 08月29日 11:35

好工具,能打造成通用的就好了。appium,macaca,wda 等等

也遇到了同样的问题,浏览器一直显示 Waiting Device start。

恩,和前 2 位遇到了同样的问题

匿名 #125 · 2016年08月29日

WDA 也要重新拉取吧?

#7 楼 @Tank007 wda 随着升级会自动下载新的啊

@freeskyday @rik782 问题麻烦回复下 issue,真机还是模拟器?型号,哪个平台

#9 楼 @xdf 三星 note3 安卓平台,这个还需要安装其他的依赖吗?

#9 楼 @xdf 我是真机,iOS 手机是 6s

@rik782 macaca doctor 检查下你的系统环境

@xdf 我的是真机,三星 note3,android

@xdf macaca doctor 检测的系统环境截图

Waiting Device start。 模拟器,android

#12 楼 @xdf 环境都检测 OK 了,发现还是存在此问题

给达峰赞一个

我也是 orz,一直就没能用上过

Python3.4 安装的,虚拟机和魅族真机都试过了,都是显示下图

有个朋友在 Python 2.7.9 安装的 WIN 上面 OK,Mac 上面也是显示上图,不清楚是不是版本问题

@nana_2016 不依赖 python 环境啊,安装中的报错贴出来

整了半天还是显示 waiting devices start,安卓机、模拟器都试了

安装中有报错,代表安装有问题,肯定有问题的啊

同上述问题 一直 waitingdevice start。真机 ios

#23 楼 @xdf android 真机没有问题,但是 iOS 一直提示 waiting device start. macaca doctor 检查都是没有问题的

xpath 在滑动页面之后,获取的好像有问题。。

问题麻烦提 issue,方便一一处理

因崔斯特,一直觉得 appium inspector 有点重,因为我 appium server 不用 UI 的,尝试用这个工具替代
我也是 waiting device start... iPhone6 真机,这个 inspector 需要 macaca 环境支持吗?

这个能否增加获取元素的 id,这样会更加方便吧

#29 楼 @fengmiss source-id 就是

#30 楼 @xdf 我的显示没有 source-id,这是我弄得方式有问题吗?
bounds
isEnabled
isVisible
value
label
type
name
rawIdentifier
class
XPath

@fengmiss 你是 iOS?

resouce-id android 才有哦

达峰的夏天 [该话题已被删除] 中提及了此贴 09月05日 22:10
达峰的夏天 [该话题已被删除] 中提及了此贴 09月17日 17:20

安装报错
环境 win7 sp1 x86 + node 4.4.0
1、安装了 cnpm
2、安装了 macaca 主程序(安装正确)
3、用 macaca doctor 检查环境(全绿色,PATH 已经配置)
4、安装 app-inspector 报错,错误如下:

5、尝试运行,报错如下:

我也尝试了一下,报错了......
环境 win10 + node 4.4.4
1、安装了 cnpm
2、安装了 macaca 主程序(安装正确)
3、用 macaca doctor 检查环境(全绿色,PATH 已经配置)

4、安装 app-inspector 报错,错误如下:

5、真机尝试

匿名 #93 · 2016年09月19日


检查环境没有问题,install app-inspector -g 报上面的错误;

一直等待中啊

我也是一直等待中。。。。。

#38 楼 @ws96apt 相同的问题,环境检查 ok,uiautomator-client 报错

达峰的夏天 [该话题已被删除] 中提及了此贴 10月21日 15:45

@xdf 这个支持 XCUITest,以及 iOS10 的系统吗?
谢谢

#45 楼 @Lihuazhang @xdf
求指点

1.我在安装过程中,执行 npm install app-inspector -g 命令,出现以下 error:

/usr/local/lib/node_modules/app-inspector/node_modules/uiautomator-client/scripts/build.js:178
      throw e;
      ^

Error: $JAVA_HOME is not set
    at checkJavaHome.then.catch.then.then.catch.then.std (/usr/local/lib/node_modules/app-inspector/node_modules/java-home/lib/java-home.js:89:25)
    at process._tickCallback (internal/process/next_tick.js:103:7)

但是我是配置了 JAVA_HOME 的,通过 echo $JAVA_HOME 也能看到值。

localhost:bin junewang$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home

2.之后,执行 app-inspector -u YOUR-DEVICE-ID
没有出现 http 的地址,自己在浏览器中手动输入 localhost:5678
一直出现 Waiting Devices start

能指导一下你是如何安装成功并使用的吗?谢谢

安卓执行 app-inspector -u YOUR-DEVICE-ID,能成功,但是 ios 就不行。
macaca doctor 环境都是可以的

达峰的夏天 [该话题已被删除] 中提及了此贴 10月26日 18:21

支持真机 iOS10.1 吗?

#46 楼 @junewang 我也遇到同样问题,期待解决方案

#46 楼 @junewang @holyzhang
回复一下 46 楼遇到的问题:

通过定位,原因为:使用了 sudo 命令执行,而采用 sudo 执行时,获取不到 JAVA_HOME 的环境变量。

详细解释如下:
我因为权限问题,使用了 sudo 命令,来执行 npm install app-inspector -g.具体为:

sudo npm install app-inspector -g

后面查看了以下,发现如果使用 sudo 命令,是不能检测到 set 了 JAVA_HOME 的。具体参考地址为:https://github.com/macacajs/app-inspector/issues/32

给/User/xxxx/.nvm 下面的具体路径,通过 chmod 命令,设置读写权限后,执行

npm install app-inspector -g

即可安装正常运行

你试试,希望也能正常运行。

#47 楼 @466895041 我使用模拟器也跟你一样,解决了吗?是什么问题?

安装和检查环境都没有任何问题,但是运行 app-inspector -u(UDID)后,网页没有任何 UI viewer 显示,请问是什么问题呢?运行结果如图:

运行一直报错,截图如下

达峰的夏天 [公告] Macaca 已支持 iOS10 和 Android7 中提及了此贴 12月01日 16:28

我用 app-inspector -u xxxxxx --verbose 连接安卓机器,无法连接上,log 如下:

>> server.js:16:12 [master] pid:6307 server start with config:
 { port: 5678,
  verbose: true,
  udid: 'xxxx',
  ip: '192.168.1.36',
  host: 'local',
  loaded_time: '2016-12-05 14:30:13' }
>> app-inspector.js:42:10 [master] pid:6307 server start at: http://192.168.1.36:5678

我打开http://192.168.1.36:5678,页面上显示 *waiting device start... * 。

我去看了一下源码,发现执行到 /usr/local/lib/node_modules/app-inspector/node_modules/uiautomator-client/lib/uiautomator-client.js 的 line27

yield this.adb.rm(`${ANDROID_TMP_DIR}/${FILE_NAME}.jar`);

就没有执行下去了。
问了人,说
this.adb.rm(${ANDROID_TMP_DIR}/${FILE_NAME}.jar) 没有返回值,所以停在这边不往下执行,查看 adb.rm() 的返回值 为:{}
打开 abd shell, 执行 rm /data/local/tmp/uiautomator-bootstrap.jar

shell@hwedison:/ $ rm /data/local/tmp/uiautomator-bootstrap.jar
rm: /data/local/tmp/uiautomator-bootstrap.jar: No such file or directory

怀疑是 adb 的问题,但是不知道如果验证和修改了?请问是什么问题?
@xdf

终于在 iOS 上成功部署了 App Inspector,写个经验给后来的人
iOS9 以上的系统由于安全性要求,需要信任签名证书对应的开发者,具体操作方式:直接打开 WebDriverAgent,会有安全提示,具体操作步骤可以参考:http://jingyan.baidu.com/article/b0b63dbfea0bfa4a49307077.html

再补充一点,手机 wifi 跟 mac 需要在同一个网段

您好,请问我昨天还能用的,今天提示我升级 app-inspector,升级后启动页面就直接白屏了是什么原因呀?Failed to load resource: the server responded with a status of 404 (Not Found)

#42 楼 @boxiangcen xport JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
export CLASS_PATH=$JAVA_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin:$CLASS_PATH
配置完成的 java 环境,就可以了

请问 Mac 上 app-inspector 启动后报这个错,是什么原因,如何解决呀?
at /usr/local/lib/node_modules/app-inspector/node_modules/.4.6.0@co/index.js:54:5

app-inspector.js:42:10 [master] pid:4384 server start at: http://172.11.22.182:5678
xctest-client.js:58:14 [master] pid:4384 project path not found
app-inspector:66:44 [master] pid:4384 Error: >> xctest-client.js:58:14 [master] pid:4384 project path not found
at Logger.error (/usr/local/lib/node_modules/app-inspector/node_modules/.1.0.6@xlogger/lib/xlogger.js:169:9)
at XCTest.checkProjectPath (/usr/local/lib/node_modules/app-inspector/node_modules/.1.0.29@xctest-client/lib/xctest-client.js:58:14)
at XCTest.init (/usr/local/lib/node_modules/app-inspector/node_modules/.1.0.29@xctest-client/lib/xctest-client.js:51:10)
at XCTest (/usr/local/lib/node_modules/app-inspector/node_modules/.1.0.29@xctest-client/lib/xctest-client.js:39:10)
at Object.exports.initDevice (/usr/local/lib/node_modules/app-inspector/lib/ios.js:90:12)
at exports.initDevice.next ()
at onFulfilled (/usr/local/lib/node_modules/app-inspector/node_modules/.4.6.0@co/index.js:65:19)
at /usr/local/lib/node_modules/app-inspector/node_modules/.4.6.0@co/index.js:54:5
at co (/usr/local/lib/node_modules/app-inspector/node_modules/.4.6.0@co/index.js:50:10)
at toPromise (/usr/local/lib/node_modules/app-inspector/node_modules/.4.6.0@co/index.js:118:63)
(node:4384) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: >> app-inspector:66:44 [master] pid:4384 Error: >> xctest-client.js:58:14 [master] pid:4384 project path not found
at Logger.error (/usr/local/lib/node_modules/app-inspector/node_modules/.1.0.6@xlogger/lib/xlogger.js:169:9)
at XCTest.checkProjectPath (/usr/local/lib/node_modules/app-inspector/node_modules/.1.0.29@xctest-client/lib/xctest-client.js:58:14)
at XCTest.init (/usr/local/lib/node_modules/app-inspector/node_modules/.1.0.29@xctest-client/lib/xctest-client.js:51:10)
at XCTest (/usr/local/lib/node_modules/app-inspector/node_modules/.1.0.29@xctest-client/lib/xctest-client.js:39:10)
at Object.exports.initDevice (/usr/local/lib/node_modules/app-inspector/lib/ios.js:90:12)
at exports.initDevice.next ()
at onFulfilled (/usr/local/lib/node_modules/app-inspector/node_modules/.4.6.0@co/index.js:65:19)
at /usr/local/lib/node_modules/app-inspector/node_modules/.4.6.0@co/index.js:54:5
at co (/usr/local/lib/node_modules/app-inspector/node_modules/.4.6.0@co/index.js:50:10)
at toPromise (/usr/local/lib/node_modules/app-inspector/node_modules/.4.6.0@co/index.js:118:63)
(node:4384) 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.

@fffhigh0315 ,遇到了相同的问题,解决了吗?

app-inspector:66:44 [master] pid:5083 undefined

这个怎么解决?

通过这个工具获取的 xml 文件, 和 通过 driver.source 获取的 xml 文件不同.
这个工具获取的 xml 文件内容比较精简, 没有展示的内容没有显示在 xml 文件中. 这个是怎么做到的?

#54 楼 @CamillaDan 报相同的错。请问你的问题解决了吗?

nicoledeMac-mini:~ nicole$ app-inspector -u A055DCB7-131C-44AE-9F26-5B062135253C
>> xctest-client start with port: 8900
>> WebDriverAgent version: 1.0.39
>> app-inspector:66:44 [master] pid:6280 undefined
(node:6280) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: >> app-inspector:66:44 [master] pid:6280 undefined
(node:6280) 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 是不是不支持安卓模拟器的连接?真机我是都可以连接成功的.
模拟器运行后,执行: adb devices 获取的设备号是:emulator-5554 device
浏览器无法获得手机的界面.

#66 楼 @wanwan001 你的问题解决了么?我这练 IOS 真机一直报这个错

@xdf 今天升级 app-inspector@1.2.18 后,浏览器打开 IP:5678,在 UI 上点击控件,不出现红色的框框了,怎么回事?升级之前都是可以的,定位到一个 button 上自动显示红框,右侧就可以看到 name 什么,现在要把树结构一个个点开,猜才行

mac10.12.1 node 7.3.0 安装 macaca 失败, 求解,

#62 楼 @fffhigh0315 我也有这个问题,解决了吗

#66 楼 @wanwan001 请问这个问题解决了吗,我的也报同样的错

匿名 #59 · 2017年01月09日

#54 楼 @CamillaDan 请问你的这个问题解决了没

#74 楼 @lynn_qin

  1. 在执行 app-inspector -u [udid] 这条命令的后面加上 “--verbose”,即执行 app-inspector -u [udid] --verbose
  2. 执行结果得到错误 “pid:6280 undefined”,同时会提示 app-inspector 目录下的 webdriveragent 的路径,打开该目录 open /usr/local/lib/node_modules/app-inspector/node_modules/webdriveragent/WebDriverAgent
  3. 使用 XCode 打开该工程,尝试 build 会发现无法 build 成功,因为这个工程里 WebDriverAgentLib 的 Bundle Id 还是 “com.facebook.WebDriverAgentLib”,WebDriverAgentRunner 的 bundle id 还是 “com.enchantin.WebDriverAgentRunner”,而需要做的就是修改他们的 bundle id 使得可以 build 成功,具体修改步骤请参考在 MAC 上搭建 appium1.6.3 过程的第 12 步
  4. build 成功后,将 iPhone 上已经安装的 WebDriverAgent 先卸载,然后再运行app-inspector -u就可以看到 mac 上自动打开http://localhost:5678的页面了

以上就是我在我的 mac 上解决这个问题的方法,不知道是否也适合你们的情况~

@u1449475793 我运行 app-inspector -u [udid] --verbose, 报的是其他错貌似:

server.js:16:12 [master] pid:12516 server start with config:
{ port: 5678,
verbose: true,
udid: 'bb1f6c5abfef652ef6b087f434acb8de105b90d4',
ip: '10.48.18.78',
host: 'cd-yh-huangqin.local',
loaded_time: '2017-01-13 17:54:29' }
app-inspector.js:42:10 [master] pid:12516 server start at: http://10.48.18.78:5678
xctest-client.js:56:14 [master] pid:12516 project path: /usr/local/lib/node_modules/app-inspector/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
xctest-client start with port: 8900
xctest-client.js:233:14 [master] pid:12516 xcode version: 8.2.1
WebDriverAgent version: 1.0.41
xctest-client.js:170:14 [master] pid:12516 2017-01-13 17:54:31.047 xcodebuild[12522:404331] IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
/Users/beyondsoft/Library/Developer/Xcode/DerivedData/WebDriverAgent-ceakatlydgitcjebccsbdhchgrpn/Logs/Test/94DA19C9-9472-41C1-BFF2-2E553C43A88D/Session-WebDriverAgentRunner-2017-01-13_175431-gxDQSv.log
2017-01-13 17:54:31.047 xcodebuild[12522:404330] [MT] IDETestOperationsObserverDebug: (718F959D-5B1B-47D4-9C49-E75A060790A6) Beginning test session WebDriverAgentRunner-718F959D-5B1B-47D4-9C49-E75A060790A6 at 2017-01-13 17:54:31.046 with Xcode 8C1002 on target {
deviceSerialNumber: F2PLDGB3FQ0Y
identifier: bb1f6c5abfef652ef6b087f434acb8de105b90d4
deviceClass: iPhone
deviceName: iPhone
deviceIdentifier: bb1f6c5abfef652ef6b087f434acb8de105b90d4
productVersion: 10.0.1
buildVersion: 14A403
deviceSoftwareVersion: 10.0.1 (14A403)
deviceArchitecture: armv7s
deviceTotalCapacity: 13092655104
deviceAvailableCapacity: 8088752128
deviceIsTransient: NO
ignored: NO
deviceIsBusy: NO
deviceIsActivated: YES
deviceActivationState: Activated
deviceType:
supportedDeviceFamilies: (
1
)
applications: (null)
provisioningProfiles: (null)
activityProgress: -2
activityTitle:

hasInternalSupport: NO
isSupportedOS: YES
developerDiskMountError: (null)
(null)
} (10.0.1 (14A403))

xctest-client.js:171:14 [master] pid:12516 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
xctest-client.js:170:14 [master] pid:12516 writeDictToFile:1278 ==== Successfully wrote Manifest cache to /var/folders/sv/0x5js8lj6k1gbk3gv45k171w0000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/d40c6571a14c026f3c9845448b045354/bb1f6c5abfef652ef6b087f434acb8de105b90d4/ManifestCache.plist

xctest-client.js:171:14 [master] pid:12516 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
xctest-client.js:170:14 [master] pid:12516 2017-01-13 17:54:50.908 xcodebuild[12522:404330] Error Domain=com.apple.dtdevicekit Code=-402652994 "App installation failed" UserInfo={NSLocalizedFailureReason=This application's application-identifier entitlement does not match that of the installed application. These values must match for an upgrade to be allowed., com.apple.dtdevicekit.stacktrace=(
0 DTDeviceKitBase 0x000000010bf0137b DTDKCreateNSError + 113
1 DTDeviceKitBase 0x000000010bf01ab9 DTDK_AMDErrorToNSError + 791
2 DTDeviceKitBase 0x000000010bf419df __90-[DTDKRemoteDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 158
3 DVTFoundation 0x000000010310e989 DVTInvokeWithStrongOwnership + 75
4 DTDeviceKitBase 0x000000010bf41725 -[DTDKRemoteDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1181
5 IDEiOSSupportCore 0x000000010be37e1f __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.336 + 4597
6 DVTFoundation 0x0000000103232cb7 __DVTDispatchAsync_block_invoke + 827
7 libdispatch.dylib 0x00007fffd29b3f5f _dispatch_call_block_and_release + 12
8 libdispatch.dylib 0x00007fffd29ab128 _dispatch_client_callout + 8
9 libdispatch.dylib 0x00007fffd29c1b97 _dispatch_queue_serial_drain + 896
10 libdispatch.dylib 0x00007fffd29b3d41 _dispatch_queue_invoke + 1046
11 libdispatch.dylib 0x00007fffd29acee0 _dispatch_root_queue_drain + 476
12 libdispatch.dylib 0x00007fffd29accb7 _dispatch_worker_thread3 + 99
13 libsystem_pthread.dylib 0x00007fffd2bf8736 _pthread_wqthread + 1299
14 libsystem_pthread.dylib 0x00007fffd2bf8211 start_wqthread + 13
), NSLocalizedRecoverySuggestion=This application's application-identifier entitlement does not match that of the installed application. These values must match for an upgrade to be allowed., NSLocalizedDescription=App installation failed}
2017-01-13 17:54:50.908 xcodebuild[12522:404330] Error Domain=IDETestOperationsObserverErrorDomain Code=5 "Early unexpected exit, operation never finished bootstrapping - no restart will be attempted" UserInfo={NSLocalizedDescription=Early unexpected exit, operation never finished bootstrapping - no restart will be attempted}

xctest-client.js:171:14 [master] pid:12516 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
xctest-client.js:170:14 [master] pid:12516
Testing failed:

xctest-client.js:171:14 [master] pid:12516 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
xctest-client.js:170:14 [master] pid:12516 Test target WebDriverAgentRunner encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted)
** TEST FAILED **

xctest-client.js:171:14 [master] pid:12516 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
xctest-client.js:267:14 [master] pid:12516 killing deviceLogProc pid: 12519
xctest-client.js:272:14 [master] pid:12516 killing runnerProc pid: 12522
xctest-client.js:278:14 [master] pid:12516 killing iproxyProc pid: 12521
xctest-client.js:181:14 [master] pid:12516 xctest client exit with code: 65, signal: null
xctest-client.js:145:16 [master] pid:12516 deviceconsole exit with code: null, signal: SIGKILL
xctest-client.js:255:14 [master] pid:12516 Fail to start xctest: undefined
app-inspector:66:44 [master] pid:12516 undefined
(node:12516) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: >> app-inspector:66:44 [master] pid:12516 undefined
(node:12516) 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.
xctest-client.js:209:14 [master] pid:12516 iproxy exit with code: null, signal: SIGKILL

#76 楼 @lynn_qin 你的报错日志里有我说的 “Please check project...”


请问你试过我后面说的步骤了么?Xcode 打开工程后 bundle id 确认过了么?建议跑app-inspector -u [udid] --verbose前先卸载掉原先安装的 WebDriverAgent~

试过了, 两个文件的 bundle id 都修改过, 也 build 成功了。而且每次实验之前都是把之前的版本卸载掉的

#78 楼 @lynn_qin 那我也不知道怎么回事了。。我这边现在使用都很正常了

@ u1449475793 我卸载了重装有又重新修改文件并 build 也成功了,但还是报这个错😭

#80 楼 @lynn_qin 卸载后重装是运行 app-inspector 时自动安装的么?

不是, 是把 macaca 相关的都卸载了,重新装了一遍

@u1449475793 我知道了,我安装 app-inspector 的时候 build inspector 是失败的
一直没成功过 不知道是什么原因

求助:大神

终端输入 macaca doctor 之后出现这种情况,
怎么配置 java_home,android_home?

#46 楼 @junewang 你好,你的 JAVA_HOME 环境是怎么配置的?总是失败

#46 楼 @junewang 你的问题解决了吗?我现在出现的问题跟你的一模一样的,怎么解决的?

app-inspector:66:44 [master] pid:1812 undefined
请问这是什么意思?

#75 楼 @xdf @u1449475793 HI 你好,我按照你的办法解决了报错了,运行 app-inspector -u 设备 udid MAC 可以自动打开查看元素的页面,但是怎么能去查看我的被测 APP 的元素树呢?我打开了被测 APP 之后再打开 inspector 也会返回到桌面,之后网页上显示的就是桌面上的元素了。。

#89 楼 @yefnegjun 在网页上显示桌面上元素的前提下,再次打开目标 APP,然后刷新网页不行么?手机端每次页面变化后,都需要重新刷新网页哦~

@lynn_qin 你的问题解决了么?我有和你一样的问题,求解决方法

39楼 已删除
达峰的夏天 Macaca 升级策略调整 [2017-02] 中提及了此贴 02月17日 14:18
达峰的夏天 uiautomator2.0 获取不到界面元素 中提及了此贴 02月19日 19:16

输入命令 app-inspector -u iosudid 然后报错,报错的信息好像是无法用 adb 启动这个设备,,求解

#83 楼 @lynn_qin 请问你是怎么解决的 一开始跟你遇到的一模一样的问题 然后按照你们在上面的讨论都一一试过了, 可是你后来也没贴出来解决没有, 卡在这里几天了 😟 🙏

安卓模拟器,报这个错,请问有解吗?

➜  ~ app-inspector -u 127.0.0.1:62001
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stream=
com.android.uiautomator.client.Initialize:
>> socket server ready
>> socket client ready
>> Android device started: 127.0.0.1:62001
>> inspector start at: http://192.168.31.20:5678
  <-- GET /
recive: {"cmd":"getSource","args":{}}

return: {"data":{"value":true,"status":0},"success":true}

>> Dump Android XML success, save to /usr/local/lib/node_modules/app-inspector/.temp/android.json

  TypeError: Cannot read property 'node' of undefined
      at Object.exports.dumpXMLAndScreenShot (/usr/local/lib/node_modules/app-inspector/lib/android.js:55:31)
      at next (native)
      at onFulfilled (/usr/local/lib/node_modules/app-inspector/node_modules/co/index.js:65:19)
      at process._tickCallback (internal/process/next_tick.js:103:7)

  <-- GET /favicon.ico
  --> GET /favicon.ico 404

@xiguamaomaoqiu @Sandu1213 😷 我放弃了。。。换成了 appium-ios-inspector
因为到最后都没解决

这工具定位很烂,也没人改改

Android inspector 界面显示横屏是怎么回事?

app-inspector 1.2.22 版本更新依然报错。如下:
INSTRUMENTATION_STATUS: numtests=1

INSTRUMENTATION_STATUS: stream=
Error in testStartServer:
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.android.uiautomator.client.CommandBase.execute(org.json.JSONObject)' on a null object reference
at com.android.uiautomator.client.Command.handleInput(Command.java:49)
at com.android.uiautomator.client.SocketServer.listen(SocketServer.java:60)
at com.android.uiautomator.client.Initialize.testStartServer(Initialize.java:28)
at com.android.uiautomator.testrunner.UiAutomatorTestRunner.start(UiAutomatorTestRunner.java:160)
at com.android.uiautomator.testrunner.UiAutomatorTestRunner.run(UiAutomatorTestRunner.java:96)
at com.android.commands.uiautomator.RunTestCommand.run(RunTestCommand.java:91)
at com.android.commands.uiautomator.Launcher.main(Launcher.java:83)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:251)

INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
INSTRUMENTATION_STATUS: test=testStartServer
INSTRUMENTATION_STATUS: class=com.android.uiautomator.client.Initialize
INSTRUMENTATION_STATUS: stack=java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.android.uiautomator.client.CommandBase.execute(org.json.JSONObject)' on a null object reference
at com.android.uiautomator.client.Command.handleInput(Command.java:49)
at com.android.uiautomator.client.SocketServer.listen(SocketServer.java:60)
at com.android.uiautomator.client.Initialize.testStartServer(Initialize.java:28)
at com.android.uiautomator.testrunner.UiAutomatorTestRunner.start(UiAutomatorTestRunner.java:160)
at com.android.uiautomator.testrunner.UiAutomatorTestRunner.run(UiAutomatorTestRunner.java:96)
at com.android.commands.uiautomator.RunTestCommand.run(RunTestCommand.java:91)
at com.android.commands.uiautomator.Launcher.main(Launcher.java:83)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:251)

INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS_CODE: -1

INSTRUMENTATION_STATUS: stream=
Test results for WatcherResultPrinter=.E
Time: 0.52

FAILURES!!!
Tests run: 1, Failures: 0, Errors: 1

INSTRUMENTATION_STATUS_CODE: -1

求助,我的 appium1.6.4-beta 和 app-inspector 都遇到了这个问题,按#75 楼的方法没解决。
@u1449475793 @lynn_qin
环境:
Xcode:8.3
OSX:10.12.3
iPhone:10.3
npm:4.1.2
node: 7.7.1
app-inspector: 1.2.23
appium:1.6.4-beta
我更新了 DEVELOPMENT_TEAM_ID 且参考 https://testerhome.com/topics/6507https://github.com/appium/appium/issues/7066 都没有解决。

Macbook $ app-inspector -u e01d730b625c83ad877fb699701bc35ea3e800ec --verbose
>> server.js:16:12 [master] pid:15055 server start with config:
 { port: 5678,
  verbose: true,
  udid: 'e01d730b625c83ad877fb699701bc35ea3e800ec',
  ip: '192.168.199.187',
  host: 'Macbook-Air.local',
  loaded_time: '2017-04-05 16:11:59' }
>> app-inspector.js:42:10 [master] pid:15055 server start at: http://192.168.199.187:5678
>> xctest-client.js:56:14 [master] pid:15055 project path: /usr/local/lib/node_modules/app-inspector/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
>> xctest-client start with port: 8900
>> xctest-client.js:233:14 [master] pid:15055 xcode version: 8.3
>> WebDriverAgent version: 1.1.4
>> xctest-client.js:170:14 [master] pid:15055 2017-04-05 16:12:00.966 xcodebuild[15061:180065]  IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
/Users/xiaoxue/Library/Developer/Xcode/DerivedData/WebDriverAgent-ceakatlydgitcjebccsbdhchgrpn/Logs/Test/C8410ABE-7B7D-4BC9-9C2B-164C8FC8BF93/Session-WebDriverAgentRunner-2017-04-05_161200-jXjtOI.log

>> xctest-client.js:171:14 [master] pid:15055 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
>> xctest-client.js:170:14 [master] pid:15055 2017-04-05 16:12:00.966 xcodebuild[15061:180059] [MT] IDETestOperationsObserverDebug: (0B81C369-7C6E-418B-B384-10B7618E1E72) Beginning test session WebDriverAgentRunner-0B81C369-7C6E-418B-B384-10B7618E1E72 at 2017-04-05 16:12:00.966 with Xcode 8E162 on target <DVTiOSDevice: 0x7fa024135640> {
        deviceSerialNumber:         F18PJBB1G5MQ
        identifier:                 e01d730b625c83ad877fb699701bc35ea3e800ec
        deviceClass:                iPhone
        deviceName:                 iPhone 6
        deviceIdentifier:           e01d730b625c83ad877fb699701bc35ea3e800ec
        productVersion:             10.3
        buildVersion:               14E277
        deviceSoftwareVersion:      10.3 (14E277)
        deviceArchitecture:         arm64
        deviceTotalCapacity:        12242530304
        deviceAvailableCapacity:    6803267584
        deviceIsTransient:          NO
        ignored:                    NO
        deviceIsBusy:               NO
        deviceIsActivated:          YES
        deviceActivationState:      Activated
        isPasscodeLocked:           NO
        deviceType:                 <DVTDeviceType:0x7fa023ba9a80 Xcode.DeviceType.iPhone>
        supportedDeviceFamilies:    (
    1
)
        applications:              (null)
        provisioningProfiles:      (null)
        activityProgress:          -2
        activityTitle:
        hasInternalSupport:        NO
        isSupportedOS:             YES
        developerDiskMountError:   (null)
(null)
    bootArgs:                  <unavailable>
        } (10.3 (14E277))

>> xctest-client.js:171:14 [master] pid:15055 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
>> xctest-client.js:170:14 [master] pid:15055 MDMCreateDeltaDirectory:1920 calling MDMDirectoryDiff with:
state->old_bundle: /var/folders/f3/fsxd3f315vg22yc0997bxrl00000gp/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/d1223d9c623a1a7f824cae92774bd47a/e01d730b625c83ad877fb699701bc35ea3e800ec/WebDriverAgentRunner-Runner.app
state->new_bundle: /Users/xiaoxue/Library/Developer/Xcode/DerivedData/WebDriverAgent-ceakatlydgitcjebccsbdhchgrpn/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app
state->dst_bundle: /var/folders/f3/fsxd3f315vg22yc0997bxrl00000gp/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.Hj9Hh6/WebDriverAgentRunner-Runner.app_sparse.ipa/Payload//WebDriverAgentRunner-Runner.app, binaryDiff flag: FALSE
    dst_ipa: /var/folders/f3/fsxd3f315vg22yc0997bxrl00000gp/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.Hj9Hh6/WebDriverAgentRunner-Runner.app_sparse.ipa

>> xctest-client.js:171:14 [master] pid:15055 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
>> xctest-client.js:170:14 [master] pid:15055 __MDMDirectoryDiff_block_invoke.37:1473 calling writeDictToFile with: /var/folders/f3/fsxd3f315vg22yc0997bxrl00000gp/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.Hj9Hh6/WebDriverAgentRunner-Runner.app_sparse.ipa/ManifestCache.plist

>> xctest-client.js:171:14 [master] pid:15055 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
>> xctest-client.js:170:14 [master] pid:15055 writeDictToFile:1278 ==== Successfully wrote Manifest cache to /var/folders/f3/fsxd3f315vg22yc0997bxrl00000gp/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.Hj9Hh6/WebDriverAgentRunner-Runner.app_sparse.ipa/ManifestCache.plist

>> xctest-client.js:171:14 [master] pid:15055 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
>> xctest-client.js:170:14 [master] pid:15055 2017-04-05 16:12:08.004 xcodebuild[15061:180059] Error Domain=IDETestOperationsObserverErrorDomain Code=6 "Early unexpected exit, operation never finished bootstrapping - no restart will be attempted" UserInfo={NSLocalizedDescription=Early unexpected exit, operation never finished bootstrapping - no restart will be attempted}

>> xctest-client.js:171:14 [master] pid:15055 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
>> xctest-client.js:170:14 [master] pid:15055
Testing failed:
    Test target WebDriverAgentRunner encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted)

>> xctest-client.js:171:14 [master] pid:15055 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
>> xctest-client.js:170:14 [master] pid:15055 ** TEST FAILED **


>> xctest-client.js:171:14 [master] pid:15055 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
>> xctest-client.js:265:14 [master] pid:15055 killing deviceLogProc pid: 15058
>> xctest-client.js:270:14 [master] pid:15055 killing runnerProc pid: 15061
>> xctest-client.js:276:14 [master] pid:15055 killing iproxyProc pid: 15060
>> xctest-client.js:181:14 [master] pid:15055 xctest client exit with code: 65, signal: null
>> xctest-client.js:145:16 [master] pid:15055 deviceconsole exit with code: null, signal: SIGKILL
>> xctest-client.js:257:14 [master] pid:15055 Fail to start xctest: undefined
>> app-inspector:66:44 [master] pid:15055 undefined
(node:15055) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: >> app-inspector:66:44 [master] pid:15055 undefined
(node:15055) 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.
>> xctest-client.js:209:14 [master] pid:15055 iproxy exit with code: null, signal: SIGKILL
和曦 MacOs 环境安装配置 macaca 总结记 中提及了此贴 04月05日 17:39

你好 ,有遇到这样的问题吗。环境检查都是 i 正常的,安装时候提示安卓环境设置的错误直接忽略了(只需要 ios 环境)。
运行会报如下图错误,并且卡死在这里

Xcode:8.3
OSX:10.12.4
iPhone:10.1.1
npm:4.2.0
node: v7.8.0
app-inspector: 1.2.23
appium:1.6.3



wangst 回复

你好,你这个问题好了吗。我是配置了 java 环境,没有配置安卓环境,只需要用 iOS。
然后也是提示类似错误,请问你的解决了吗

Dan 回复

你好,你问题解决了吗。我现在也是同样的问题

app inspector 在浏览器里可以录制脚本吗?appium 图形界面是不是可以直接启动 inspector 录制,命令行可以吗?感谢😀

Dan 回复

我的也是,真机启动过后闪退,然后就这样了,你的解决了吗?

嗯,看到了,现在在配置 app inspector 真机运行跑不起来报和 66 楼一样的错误,你那遇到过这种问题吗?

升级 app-inspector 1.2.25,连不上手机了,有人碰到过吗

@tlllly 你的问题解决了吗,我是把 app-inspector 更新到 1.2.27,出现了这个问题

Hong 回复

没有解决,我准备用 appium 的 desktop 版本去获取元素

磊磊 回复

@tlllly 我用的https://github.com/mykola-mokhnach/Appium-iOS-Inspector 这个工具,appium 自带的,可以用

我早上 app-inspector 升级到了 1.2.27,也尝试了各种办法,macaca doctor 也都没有问题。
运行命令 app-inspector -u XXXXX --verbose 能看到显示 5 个 swift 编译失败
最后把 xcode 升级到最新版。
然后再运行,app-inspector 终于又能用了!!!!!

Eric 回复

好坑,我的 xcode 是 8.1,我的也是提示 swift 编译失败,去升级看看,谢谢。

升级 macaca-cli 执行 macaca doctor 更新环境

ELes 回复

你好 我也是这个问题,请问解决了吗

匿名 #9 · 2017年08月14日

@xdf 最新版的貌似是 XCTestWD 这个可以不可以提两个要求 1.是会生成两个 app 能不能合并成一个 2.source 只有 json 格式的能不能提供个 xml 的 非常感谢

JasonChiang 回复

请问解决了么

匿名 #125 · 2019年06月07日

大神 请问下阿里那边现在关于 App 端一些数据上报的测试是怎么做的呀 让我们膜拜下

数据上报的测试 是指哪些场景?

匿名 #5 · 2019年06月10日

一些 App 的产品数据 比如页面曝光 动作啥的 在测试的时候是什么策略呢

边运行测试,边收集埋点一类的数据进行断言啊

匿名 #3 · 2019年06月10日

有自动化测试么

安装了 n 边了。。启动的时候报链接设备失败,可以怎么处理啊?
eblisdeMacBook-Air:~ eblis$ app-inspector -u 644379335e56dde99778c8165bf8 --verbose

server.js:16:12 [master] pid:3155 server start with config:
{ port: 5678,
verbose: true,
udid: '644379335e56dde99778c8165bf8',
ip: '192.168.26.37',
host: 'eblisdeMacBook-Air.local',
loaded_time: '2019-07-18 13:49:42' }
app-inspector.js:45:12 [master] pid:3155 server start at: http://192.168.26.37:5678
xctest-client.js:56:14 [master] pid:3155 project path: /usr/local/lib/node_modules/app-inspector/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
xctest-client.js:283:14 [master] pid:3155 xcode version: 10.2.1
XCTestWD version: 1.4.18
xctest-client.js:227:20 [master] pid:3155 hitted for default mode
xctest-client.js:230:20 [master] pid:3155 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
xctest-client.js:309:14 [master] pid:3155 Fail to start xctest: Error: Command failed: which iproxy

xctest-client.js:322:14 [master] pid:3155 killing runnerProc pid: 3158
{ Error: Command failed: which iproxy

at ChildProcess.exithandler (child_process.js:294:12)
at ChildProcess.emit (events.js:198:13)
at maybeClose (internal/child_process.js:982:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) killed: false, code: 1, signal: null, cmd: 'which iproxy' }
iOS device started: 644379335e56dde9fc302354d9ff9778c8165bf8
inspector start at: http://192.168.26.37:5678
xctest-client.js:242:16 [master] pid:3155 xctest client exit with code: null, signal: SIGKILL
<-- GET /
helper.js:94:16 [master] pid:3155 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001

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