macacajs / app-inspector

App-inspector is a mobile UI viewer in browser.
https://macacajs.github.io/app-inspector/
MIT License
389 stars 78 forks source link

最新版的app-inspector无法获取页面元素 #228

Closed zhechengmao closed 5 years ago

zhechengmao commented 5 years ago

Environment check:

$ npm i macaca-cli -g && macaca doctor

macaca doctor

macaca-doctor version: 2.0.16

Node.js checklist:

node env: /usr/local/bin/node node version: v11.0.0

iOS checklist:

Xcode Command Line Tools is ready, version: 2354. xcodebuild version: 10.2 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 JAVA_HOME is set to /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home ANDROID_HOME is set to /Applications/android-sdk-macosx Platforms is set to /Applications/android-sdk-macosx/platforms/android-26 ADB tool is set to /Applications/android-sdk-macosx/platform-tools/adb gradle is installed, version: 5.2

Installed driver list:

android: 2.1.0 location: /usr/local/lib/node_modules/macaca-android

ios: 2.0.35 location: /usr/local/lib/node_modules/macaca-ios

try app-inspector -u xxxx --verbose for more log detail.

server.js:16:12 [master] pid:23902 server start with config: { port: 5678, verbose: true, udid: 'a6a2284c2c884cd22dba7412bf40a733b1c615d0', ip: '10.0.55.139', host: 'Mzc-Test.local', loaded_time: '2019-04-02 18:50:06' } app-inspector.js:45:12 [master] pid:23902 server start at: http://10.0.55.139:5678 xctest-client.js:56:14 [master] pid:23902 project path: /usr/local/lib/node_modules/app-inspector/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj xctest-client.js:283:14 [master] pid:23902 xcode version: 10.2 XCTestWD version: 1.4.13 xctest-client.js:227:20 [master] pid:23902 hitted for default mode xctest-client.js:230:20 [master] pid:23902 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj xctestwd start with port: 8001 proxy.js:55:14 [master] pid:23902 Proxy: /wd/hub/session:POST to http://127.0.0.1:8001/wd/hub/session:POST with body: {"desiredCapabilities":{}} proxy.js:63:22 [master] pid:23902 xctest client proxy error with: Error: read ECONNRESET xctest-client.js:230:20 [master] pid:23902 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj xctest-client.js:230:20 [master] pid:23902 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj xctest-client.js:230:20 [master] pid:23902 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj xctest-client.js:230:20 [master] pid:23902 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj proxy.js:63:22 [master] pid:23902 xctest client proxy error with: Error: read ECONNRESET proxy.js:63:22 [master] pid:23902 xctest client proxy error with: Error: read ECONNRESET proxy.js:63:22 [master] pid:23902 xctest client proxy error with: Error: read ECONNRESET proxy.js:63:22 [master] pid:23902 xctest client proxy error with: Error: read ECONNRESET proxy.js:63:22 [master] pid:23902 xctest client proxy error with: Error: read ECONNRESET proxy.js:63:22 [master] pid:23902 xctest client proxy error with: Error: read ECONNRESET proxy.js:63:22 [master] pid:23902 xctest client proxy error with: Error: read ECONNRESET proxy.js:63:22 [master] pid:23902 xctest client proxy error with: Error: read ECONNRESET proxy.js:63:22 [master] pid:23902 xctest client proxy error with: Error: read ECONNRESET proxy.js:63:22 [master] pid:23902 xctest client proxy error with: Error: socket hang up xctest-client.js:309:14 [master] pid:23902 Fail to start xctest: Error: socket hang up xctest-client.js:322:14 [master] pid:23902 killing runnerProc pid: 23905 xctest-client.js:328:14 [master] pid:23902 killing iproxyProc pid: 24170 { Error: socket hang up at createHangUpError (_http_client.js:330:15) at Socket.socketOnEnd (_http_client.js:433:23) at Socket.emit (events.js:187:15) at endReadableNT (_stream_readable.js:1094:12) at process.internalTickCallback (internal/process/next_tick.js:72:19) code: 'ECONNRESET' } iOS device started: a6a2284c2c884cd22dba7412bf40a733b1c615d0 inspector start at: http://10.0.55.139:5678 xctest-client.js:272:14 [master] pid:23902 iproxy exit with code: null, signal: SIGKILL xctest-client.js:242:16 [master] pid:23902 xctest client exit with code: null, signal: SIGKILL <-- GET / helper.js:94:16 [master] pid:23902 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001

Error: connect ECONNREFUSED 127.0.0.1:8001 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1117:14)

<-- GET /

helper.js:94:16 [master] pid:23902 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001

Error: connect ECONNREFUSED 127.0.0.1:8001 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1117:14)

zhechengmao commented 5 years ago

都无奈了,之前配置的都是运行好好的,从上次macaca-ios驱动更新出问题以后,我把macaca-ios驱动卸了,然后这个app-inspector也卸载了,全部重新安装,该签名的都签名了,该重新打包安装的也安装了,运行脚本的时候是没问题的,但是用到这个app-inspector获取界面元素就不行了,一脸懵逼,步骤完全没有错,还是说,版本更新以后有什么特殊的步骤,建议官方人员能不能把自己的环境清理一下,然后重新配置一下看看是不是有问题,写个脚本,大部分时间都是用在环境配置这上面也是醉了。。。

macaca-bot commented 5 years ago

This is the translated issue comment: @zhechengmao


All helpless, the previous configuration is running well, after the last macaca-ios driver update problem, I uninstalled the macaca-ios driver, and then the app-inspector is also uninstalled, all re-installed, the signature All signed, the repackaged installation is also installed, running the script is no problem, but using the app-inspector to get the interface elements will not work, a face is too aggressive, the steps are completely wrong, or say, the version After the update, what are the special steps, it is recommended that the official staff can clean up their environment, and then re-configure to see if there is a problem, write a script, most of the time is used in the environment configuration is also drunk. . .

paradite commented 5 years ago

同学是真机吗?真机看看这个: https://macacajs.github.io/zh/guide/environment-setup.html#ios-%E7%9C%9F%E6%9C%BA%E7%8E%AF%E5%A2%83

macaca-bot commented 5 years ago

This is the translated issue comment: @paradite


Is the classmate a real machine? Real machine to see this? https://macacajs.github.io/en/guide/environment-setup.html#ios-%E7%9C%9F%E6%9C%BA%E7%8E%AF%E5%A2%83

paradite commented 5 years ago

有其他同学遇到这个问题成功解决了哦,你看看是不是哪一步遗漏了: https://github.com/alibaba/macaca/issues/899

macaca-bot commented 5 years ago

This is the translated issue comment: @paradite


Some other students have successfully solved this problem. You can see if it is missing: Https://github.com/alibaba/macaca/issues/899

zhechengmao commented 5 years ago

有其他同学遇到这个问题成功解决了哦,你看看是不是哪一步遗漏了: alibaba/macaca#899

真机调试运行脚本是可以的,不过我用app-inspector查看界面元素出问题了,涉及到的这个安装的步骤我罗列一下哈 1:DEVELOPMENT_TEAM_ID=** npm i app-inspector -g 2:全局安装完成后,我针对这个里面的XCTestWD进行签名,打包编译,然后安装到真机上,一路运行来下都是成功的 3:唯独运行app-inspector -u a6a2284c2c884cd22dba7412bf40a733b1c615d0 --verbose 这一步的时候,报上面的错误了,如下图: image 因为之前macaca-ios驱动出问题,后来我全部卸载了重新安装的,然后编译macaca-ios里面的XCTestWD报错,说swift需要5.0版本,然后我又升级的系统到10.14.4,又把Xcode升级到10.2,最后ios真机调试是可以的了,结果app-inspector出问题了。。

macaca-bot commented 5 years ago

This is the translated issue comment: @zhechengmao


Some other students have successfully solved this problem, you see if it is missing: [alibaba/macaca#899] (https://github.com/alibaba/macaca/issues/899)

The real machine debugging run script is fine, but I used the app-inspector to view the interface elements. I have listed the steps involved in this installation. 1: DEVELOPMENT_TEAM_ID = ** npm i app-inspector -g 2: After the global installation is completed, I will sign the XCTestWD in this package, package and compile it, and then install it on the real machine. All the way to run is successful. 3: Run app-inspector -u a6a2284c2c884cd22dba7412bf40a733b1c615d0 --verbose This step, the above error is reported, as shown below: !image Because the macaca-ios driver problem, I later uninstalled the reinstall, and then compiled the XCTestWD inside macaca-ios error, saying that swift needs version 5.0, then I upgraded the system to 10.14.4, and upgraded Xcode to 10.2, the final ios real machine debugging is ok, and the result app-inspector has a problem. .

paradite commented 5 years ago

XCTestWD这个签名需要用/usr/local/lib/node_modules/app-inspector/node_modules/xctestwd 里面的XCTestWD,你是不是用了macaca-ios里面的XCTestWD

macaca-bot commented 5 years ago

This is the translated issue comment: @paradite


XCTestWD needs to use /usr/local/lib/node_modules/app-inspector/node_modules/xctestwd Inside XCTestWD, did you use XCTestWDinmacaca-ios?

paradite commented 5 years ago

或者试试用环境变量传XCTestWD的位置:

$ MACACA_XCTESTWD_ROOT_PATH=/path/to/macaca_xctest app-inspector -u xxx --verbose

https://github.com/macacajs/XCTestWD#44 https://github.com/macacajs/XCTestWD/blob/master/lib/xctestwd.js#L5-L9

macaca-bot commented 5 years ago

This is the translated issue comment: @paradite


Or try to pass the location of XCTestWD with the environment variable:

$ MACACA_XCTESTWD_ROOT_PATH=/path/to/macaca_xctest app-inspector -u xxx --verbose

https://github.com/macacajs/XCTestWD#44 https://github.com/macacajs/XCTestWD/blob/master/lib/xctestwd.js#L5-L9

zhechengmao commented 5 years ago

XCTestWD这个签名需要用/usr/local/lib/node_modules/app-inspector/node_modules/xctestwd 里面的XCTestWD,你是不是用了macaca-ios里面的XCTestWD? 签名这个没问题的,如果真机运行脚本的话,我是安装的macaca-ios里面的,如果是通过网页查看获取界面元素,我会用app-inspector里面的,我试试你说的那个环境变量传XCTestWD位置哈

macaca-bot commented 5 years ago

This is the translated issue comment: @zhechengmao


XCTestWD needs to use XCTestWDin/usr/local/lib/node_modules/app-inspector/node_modules/xctestwd. Do you use XCTestWDinmacaca-ios? Signature This is no problem, if the real machine runs the script, I installed macaca-ios inside, if it is through the web page to get the interface elements, I will use the app-inspector inside, I try the environment variable you said Pass XCTestWD location

paradite commented 5 years ago

另外还有一个可能性,是node.js的坑,安装macaca-iosapp-inspector之类的,不同的pacakge之间依赖会乱掉。 既然有人用app-inspector单独成功了,你的脚本也运行成功了,那有可能是脚本和app-inspector一起装的时候,node_modules依赖乱掉了。 你把全局的包都卸了,只安装app-inspector试试。

macaca-bot commented 5 years ago

This is the translated issue comment: @paradite


There is also a possibility, the pit of node.js, install macaca-ios, app-inspector and the like, the dependencies between different pacakges will be messed up. Since someone has succeeded with app-inspector alone, your script has also run successfully. It is possible that the node_modules dependency is messed up when the script is installed with app-inspector. You have unloaded the global package, just install app-inspector.

zhechengmao commented 5 years ago

另外还有一个可能性,是node.js的坑,安装macaca-iosapp-inspector之类的,不同的pacakge之间依赖会乱掉。 既然有人用app-inspector单独成功了,你的脚本也运行成功了,那有可能是脚本和app-inspector一起装的时候,node_modules依赖乱掉了。 你把全局的包都卸了,只安装app-inspector试试。

目前两个都试了,还是不行T_T。。。。 我把macaca-ios卸载了,只留了app-inspector,然后试了一下不行 然后我用你说的那个环境变量的方法试了一下,也还是不行,有点懵了。。 image

macaca-bot commented 5 years ago

This is the translated issue comment: @zhechengmao


There is another possibility, the pit of node.js, the installation of macaca-ios, app-inspector and the like, the dependencies between different pacakges will be messed up. Since someone has successfully succeeded with app-inspector, your script has also run successfully. It is possible that the node_modules dependency is messed up when the script is installed with app-inspector. You have unloaded the global package, just install app-inspector.

Currently both have tried, or not T_T. . . . I uninstalled macaca-ios, only left app-inspector, and then tried it. Then I tried it with the method of the environment variable you said, and it still didn't work, it was a little embarrassing. . !image

paradite commented 5 years ago

有可能是新的XCode版本10.2的问题,看之前成功的是XCode 10.1。我们在看了。

macaca-bot commented 5 years ago

This is the translated issue comment: @paradite


There may be a problem with the new XCode version 10.2, and the previous success was XCode 10.1. We are watching.

paradite commented 5 years ago

应该修复了,你重安下app-inspector,用Xcode重新跑下project应该就好了。

macaca-bot commented 5 years ago

This is the translated issue comment: @paradite


It should be fixed, you should re-apply the app-inspector, and you should run the project again with Xcode.

zhechengmao commented 5 years ago

应该修复了,你重安下app-inspector,用Xcode重新跑下project应该就好了。

卸载app-inspector,清理缓存后,重新安装,用xcode跑完,依然还有此问题 image

macaca-bot commented 5 years ago

This is the translated issue comment: @zhechengmao


It should be fixed. You should re-apply the app-inspector. It should be fine to run the project again with Xcode.

Uninstall app-inspector, clean up the cache, re-install, run with xcode, still have this problem !image

paradite commented 5 years ago

看了下你的XCTestWD版本不对,安装正确的话应该是1.4.18。应该是安装的问题,你试试npm或者yarn。 看我的截图:

Screenshot 2019-04-08 at 10 45 21 AM
macaca-bot commented 5 years ago

This is the translated issue comment: @paradite


Looked at your XCTestWD version is wrong, the installation should be 1.4.18. It should be an installation problem, you try npm or yarn. Look at my screenshot:

Screenshot 2019-04-08 at 10 45 21 AM
zhechengmao commented 5 years ago

采用cnpm安装app-inspector,里面的XCTestWD版本为1.4.18,该问题得以解决。

macaca-bot commented 5 years ago

This is the translated issue comment: @zhechengmao


Install the app-inspector with cnpm, the version of XCTestWD is 1.4.18, and the problem is solved.

xinxinga commented 5 years ago

@zhechengmao 我现在 macaca-iOS 遇到同样问题: ENV: Mac OS 10.13.6 + Xcode 9.3, 因为公司限制无法升级到10.14

XCTestWD version: 1.4.18 xctest-client.js:227:20 [master] pid:1471 hitted for default mode xctest-client.js:230:20 [master] pid:1471 please check project: /Users/XXX/npm-global/lib/node_modules/macaca-ios/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj xctestwd start with port: 8001 proxy.js:55:14 [master] pid:1471 Proxy: /wd/hub/session:POST to http://127.0.0.1:8001/wd/hub/session:POST with body: {"desiredCapabilities":{"bundleId":"com.xxx.XXX","platformName":"ios"}} proxy.js:63:22 [master] pid:1471 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001 proxy.js:63:22 [master] pid:1471 xctest client proxy error with: Error: read ECONNRESET proxy.js:63:22 [master] pid:1471 xctest client proxy error with: Error: read ECONNRESET proxy.js:63:22 [master] pid:1471 xctest client proxy error with: Error: read ECONNRESET proxy.js:63:22 [master] pid:1471 xctest client proxy error with: Error: read ECONNRESET

macaca-bot commented 5 years ago

This is the translated issue comment: @xinxinga


@zhechengmao I am having the same problem with macaca-iOS: ENV: Mac OS 10.13.6 + Xcode 9.3, because the company limit cannot be upgraded to 10.14

XCTestWD version: 1.4.18 xctest-client.js:227:20 [master] pid:1471 hitted for default mode xctest-client.js:230:20 [master] pid:1471 please check project: /Users/XXX/npm-global/lib/node_modules/macaca-ios/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj xctestwd start with port: 8001 proxy.js:55:14 [master] pid:1471 Proxy: /wd/hub/session:POST to http://127.0.0.1:8001/wd/hub/session:POST with body: {"desiredCapabilities" :{"bundleId":"com.xxx.XXX","platformName":"ios"}} proxy.js:63:22 [master] pid:1471 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001 proxy.js:63:22 [master] pid:1471 xctest client proxy error with: Error: read ECONNRESET proxy.js:63:22 [master] pid:1471 xctest client proxy error with: Error: read ECONNRESET proxy.js:63:22 [master] pid:1471 xctest client proxy error with: Error: read ECONNRESET proxy.js:63:22 [master] pid:1471 xctest client proxy error with: Error: read ECONNRESET

paradite commented 5 years ago

@xinxinga 需要Xcode最新版的(10.2以上)

macaca-bot commented 5 years ago

This is the translated issue comment: @paradite


@xinxinga needs the latest version of Xcode (10.2 or above)

xinxinga commented 5 years ago

@paradite 升级到了macos 10.14.4 + xcode 10.2.1 尝试了 npm i macaca-ios -g , 然后uninstall, 又 cnpm i macaca-ios -g 同样的问题。

macaca-bot commented 5 years ago

This is the translated issue comment: @xinxinga


@paradite Upgraded to macos 10.14.4 + xcode 10.2.1 I tried npm i macaca-ios -g , then uninstall, and cnpm i macaca-ios -g the same problem.

paradite commented 5 years ago

@xinxinga 你运行是app-inspector还是macaca? 如果是app-inspector,请在这里开新的issue,提供下你是怎么运行的,报错的log和macaca doctor log。 如果是macaca,也请在这里开新的issue,提供下你是怎么运行的,报错的log,和macaca doctor log。 这个issue已经关闭了。

macaca-bot commented 5 years ago

This is the translated issue comment: @paradite


@xinxinga Are you running app-inspector or macaca? If it is an app-inspector, please open a new issue at [here] (https://github.com/alibaba/macaca/issues), provide information on how you run it, report the error log and macaca doctor log. If it is macaca, please open a new issue at [here] (https://github.com/alibaba/macaca/issues), provide information on how you run it, report the error, and macaca doctor log. This issue has been closed.

zhechengmao commented 5 years ago

@paradite 升级到了macos 10.14.4 + xcode 10.2.1 尝试了 npm i macaca-ios -g , 然后uninstall, 又 cnpm i macaca-ios -g 同样的问题。

帮组内同学搭建环境遇到过你这个问题,把xcode换成10.2版本可以解决,10.2.1版本有问题, xcode下载地址:https://download.developer.apple.com/Developer_Tools/Xcode_10.2/Xcode_10.2.xip

macaca-bot commented 5 years ago

This is the translated issue comment: @zhechengmao


@paradite Upgrade to macos 10.14.4 + xcode 10.2.1 I tried npm i macaca-ios -g , then uninstall, and cnpm i macaca-ios -g the same problem.

Helping the students in the group to build the environment encountered your problem, the xcode can be solved by the 10.2 version, the 10.2.1 version has problems, Xcode download address: https://download.developer.apple.com/Developer_Tools/Xcode_10.2/Xcode_10.2.xip