STF STF 集成 iOS 之 开源了

mrx102 · June 19, 2019 · Last by 黑山老妖 replied at November 13, 2019 · 16759 hits
本帖已被设为精华帖!

前言

之前写了两篇关于STF集成iOS的文章
STF 集成 iOS 之设备连接
STF 集成 iOS 之远程控制
虽然没什么响应,但是还是有同学希望能开源出来,秉着相互学习的心态,就把它开源出来吧。

项目地址

https://github.com/mrx1203/stf.git
https://github.com/mrx1203/WebDriverAgent.git
iOS的集成依赖于WebDriverAgent,我对WebDriverAgent做了一些小改动,以更好的支持iOS的远程操控。

部署方法

iOS是以增加一个ios-provider和ios-device的形式集成的,所以,STF原来的服务不受任何影响,之前怎么部署,现在还是怎么部署。

环境准备

安装libimobiledevice等依赖工具。

brew install  usbmuxd
brew link usbmuxd
brew install libimobiledevice
brew install ideviceinstaller
brew install carthage
brew install socat

安装stf依赖:brew install graphicsmagick zeromq protobuf yasm pkg-config

clone代码WebDriverAgent,假设代码存放路径为/Users/test/Desktop/WebDriverAgent/,这个路径在启动ios-provider是通过--wda-path传入。配置好WebDriverAgent,具体方法自行搜索。XCode 用10.1及以下的版本

启动ios-provider

因为ios-provider需要使用xcodebuild等mac下的命令行工具,而docker容器中并没有提供这类工具,所以不能用docker来部署ios-provider,只能通过源码方式部署。部署步骤如下:
(1)拉取源代码git clone https://github.com/mrx1203/stf.git
(2)切换到stf目录下,安装依赖库npm install;npm install --save request;npm install --save request-promise
(3)启动ios-provider,假设主服务器的ip地址为172.28.28.36,该节点的ip地址为172.28.28.49

stf ios-provider --name "mac081" --connect-sub tcp://172.28.28.36:7250 \
--connect-push tcp://172.28.28.36:7270 --storage-url http://172.28.28.36 \
--public-ip 172.28.28.49 --heartbeat-interval 20000 \
--wda-path /Users/test/Desktop/WebDriverAgent/ --wda-port 8100

如果你没有部署过STF,那么直接 stf local --public-ip 172.28.28.49 --wda-path /Users/test/Desktop/WebDriverAgent/ --wda-port 8100

说明

前端做了改造,样式还没调,有点丑。如果不想用前端,只想接入iOS,那么只需要拷贝以下文件即可:

  • 拷贝lib/cli下的ios-device,ios-provider,local三个文件夹,local文件夹可以直接覆盖。
  • 拷贝lib/cli下的index.js文件,直接覆盖。
  • 拷贝lib/units下的ios-device,ios-provider文件夹;覆盖lib/units/storage/plugins/apk/task/manifest.js文件。
  • 拷贝lib/util下的ipareader.js和download.js文件;ipa文件解析和下载
  • 拷贝res/app/components/stf/install/install-service.js文件;ipa文件的安装
  • 拷贝res/app/components/stf/storage/storage-service.js文件;上传ipa文件
  • 拷贝lib/wire/wire.proto文件;加了消息
  • 拷贝package.json,添加了依赖模块

感谢

我们是站在巨人的肩膀上做的拼接,特别感谢以下开源项目作者。
https://github.com/openstf/stf
https://github.com/appium/WebDriverAgent
https://github.com/macacajs/app-inspector

集成过程中有问题的,欢迎加群交流,QQ群:768710274

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
共收到 114 条回复 时间 点赞
mrx102 STF 集成 iOS 之设备连接 中提及了此贴 19 Jun 18:02

我第一个顶,点赞

大赞!STF终于可以跨端了。😀

也可以尝试用下国产的 https://github.com/macacajs/XCTestWD

赞一个,一会试试

先赞一个

国内目前最好的开源iOS远程真机(一拖N),画面流畅度,远程控制操作性明显优于atxserver2,macaca等等,完美结合STF的架构,适合做二次开发。

琉丶言 回复

来个视频或gif看看效果

马克

大赞!

赞赞赞!感谢开源!

codeskyblue 回复

视频发到stf技术交流群了,群号:168170256

怒赞!

simple 将本帖设为了精华贴 20 Jun 13:58

鼓励开源项目!

作者帅的一P 👍

请问一下我在stf里面执行npm install 失败了,提示npm ERR! Unexpected end of JSON input while parsing near '.../typescript-estree/-/'是什么原因呢?有没有详细一点的教程

期待大神能讲解一下wda源码修改。

老哥,支持的iOS系统版本说一下呗。

yca · #20 · June 20, 2019
Author only
mrx102 #21 · June 21, 2019 作者
TD 回复

你再更新一下代码,有个配置jsx解析的文件忘记提交了

666666

23Floor has been deleted
琉丶言 STF 集成 iOS 之源码分析 中提及了此贴 25 Jun 18:58

执行stf启动命令时候报了如下错误,不知道其他人有没有碰到过~
imagesdoes not yet support your current environment: OS X 64-bit with Unsupported runtime (67)

mrx102 回复

更新后 还是报错了
npm ERR! Unexpected end of JSON input while parsing near '...f30ec2a8157a53333be7c'

27Floor has been deleted
Jacc 专栏文章:[Topic was deleted] 中提及了此贴 27 Jun 12:01
mrx102 #29 · June 27, 2019 作者
TD 回复

发详细日志

30Floor has been deleted

wda你的包少东西吧, build不过去啊,可以的话是不是可以用原版的wda

假设主服务器的ip地址为172.28.28.36,该节点的ip地址为172.28.28.49
没有主从的话是不是stf local就好了,好像报错找不到这个文件,看了下好像修改前STF下的node_modules也没有image目录

mrx102 #33 · July 01, 2019 作者
Xu Wang 回复

xcode用10.1及以下的版本,10.2的版本删除了一些私有api文件

mrx102 #34 · July 01, 2019 作者
grizz 回复

npm install images,你有执行npm install么?正常的话应该会安装这个依赖模块的

厉害厉害👍 👍 👍

36Floor has been deleted


请问大神,我stf local之后,现象如下
1.登录后页面中的手机一直是处于"准备中"。
2.而看日志,就是无限循环"xcodebuild构建成功"和INF/ios-provider 18168 [*] Providing 0 of 2 device(s); waiting for "da47eca163f47e16c35366bd1e0f8e3d076fb5f8"。

3.手机已经装上WebDriverAgent
望大神有空指教一下。

mrx102 #38 · July 02, 2019 作者
TangoWong1983 回复

你的WDA没有起来,看下是不是证书没有信任


请问不插手机可以访问stf页面,插上手机就会一直报错,看日志好像是无法获取设备信息,大佬能不能看一下是怎么回事。

mrx102 #40 · July 02, 2019 作者
W52 回复

应该是你的libimobiledevice工具集有问题,你在命令行下单独执行报错的命令,然后自己搜索一下解决方法

发现iphone连接一段时间后会断掉,然后无限的start wda,设备一直是准备中状态,当你没耐心等了去干别的后,再回来,竟然又连上了,好奇怪呢?

大神,再帮忙看看下面是什么问题,那个WebDriverAgent我单独在xcode上执行test。运行/status是可以看到设备信息的。感觉就是一直无限的start wda


mrx102 #43 · July 02, 2019 作者
stronger 回复

在WDA不通的情况会自动重启。无限重启有可能是我后面加重启策略的时候引入的bug,你把ios-device/plugins/wdaProxy.js下的这段代码注释掉看看:wda.on('restart',function(){
if(!bRestart)
return
plugin.restartWda()
})

mrx102 #44 · July 02, 2019 作者
TangoWong1983 回复

你这个是什么设备?ios-device/support/TypeToModel.js,看看这个文件里面有没有包含你的这个设备,如果没有,你需要自己加入。unable to find device data 这个警告可以忽略,这个只是在stf-device-db数据库里找不到这个设备的信息,没有影响。另外,iOS系统用11以上的,11以下的版本截图只有1-2帧每秒,基本上不能用。


请问我插上设备之后stf页面会一直显示准备中,看日志出现了这样的错误,并且日志会不停打印providing 0 of 1 device(s),waiting for,大佬能不能看一下是什么问题

TD · #46 · July 03, 2019
Author only

楼主,我装上后,模拟器contorl可以看到页面,真机看不到页面,一片灰,但是点击是有效果的,知道肿么回事?

分享我安装过程中遇到的一些问题
1.zmq. Could not locate the bindings file ,node11换成node8好了,一般还会需要cnpm rebuild node-sass
2.brew install libjpeg-turbo 要装
3.ios10以上截图安装:
brew install --HEAD usbmuxd
brew install --HEAD libimobiledevice

蓝蓝 回复

你是用的xcode几?

SCH 回复

xcode 10.1

蓝蓝 回复

iphone 7plus ios10.3.3是灰的,会报socket hang up.还有command failed: idevicescreenshot -u
iphone8 12.1.2可以显示页面出来了

mrx102 #52 · July 04, 2019 作者
TD 回复

你的node版本太新了,用8.9.1的试下

mrx102 #53 · July 04, 2019 作者
蓝蓝 回复

ios10的系统应该是不支持的,我换过其他的截图方式,但是在ios10上帧率太低,就没加进去了。建议用ios11以上的系统

mrx102 回复

好的,谢谢楼主的开源👍

mrx102 回复

楼主,你说的ios11以下的每秒1-2帧,这是action么?ios 12,我怎么用着也是挺卡的

mrx102 回复

我的node 版本是12.5.0的,太低了?
test01deMac-mini:~ test01$ node -v
v12.5.0
test01deMac-mini:~ test01$

mrx102 #57 · July 04, 2019 作者
TD 回复

版本太高了,用旧的版本

mrx102 #58 · July 04, 2019 作者

有问题的,可以加群交流,QQ群:768710274

59Floor has been deleted
mrx102 #60 · July 09, 2019 作者


inspector报错没关系,不影响

61Floor has been deleted
mrx102 #62 · July 09, 2019 作者

那两个参数的端口号和stf服务的对应,默认是7114和7116

63Floor has been deleted
mrx102 #64 · July 09, 2019 作者

加群,在群里说,QQ群:768710274

感谢作者分享。

npm link 提示
chunk {6} entry/commons.entry.js (entry/commons.entry.js) 0 bytes [rendered]

ERROR in Invalid or unexpected token
@ ./res/app/control-panes/inspect/huya-inspector-tab-directive.js 3:10-43
[11:52:54] Finished 'webpack:build' after 21 s
2019-07-13T03:52:55.626Z INF/webpack:config 91301 [*] Build progress 100% (complete)
up to date in 51.404s

stf页面能够登录,但是打开没有内容,谁知道是什么原因吗



请教 我的这个一直准备中,wda 应该是启动好了 执行 stf local 一直是这个日志

后来有解决吗?我也遇到了

mrx102 #69 · July 29, 2019 作者
TD 回复

现在判断wda是否启动成功有bug,如果日志中出现 WDA构建成功,然后不断打印providing 0 of 1 device的,可以改一下这个地方
把这两行代码改成

plugin.startWda()
return plugin;

但是这样改了之后,你进入控制页面可能会看不到画面,需要确认localhost:6103/status正确返回了,才会有画面。至于端口6103,可以通过ps -A | grep iproxy ,与8100对应的端口就是了

mrx102 回复

好的,改了可以的,谢谢,另外你说帖子里面有关Android的stf在linux上面部署,手机连着linux电脑上,ios的在mac上面部署,怎么在一个地址共同显示android和ios呢?这个是帖子里面哪个文章,能再具体一点么?

mrx102 #71 · July 29, 2019 作者
TD 回复

你看下stf的分布式部署,然后把mac作为一个provider,只需要启动ios-provider就可以

mrx102 回复

好的,之前就不太理解,原来是这个意思,谢谢啦

TD · #73 · July 29, 2019
Author only
mrx102 #74 · July 29, 2019 作者
TD 回复

这个要看你Android那边怎么起的服务,如果是直接stf local的,那需要加上--bind-dev-pub tcp://10.30.15.11:7114 --bind-dev-pull tcp://10.30.15.11:7116 --bind-dev-dealer tcp://10.30.15.11:7115 然后mac上执行
stf ios-provider --name "test01" --connect-sub tcp://10.30.15.11:7114 \
--connect-push tcp://10.30.15.11:7116 --storage-url http://10.30.15.11:7100 \
--public-ip 10.15.35.223 --heartbeat-interval 20000 \
--wda-path /Users/test01/Documents/workspace/stf/WebDriverAgent/ --wda-port 8110

mrx102 回复

可以显示出来ios手机了,就是我的这台手机经常是灰色的,偶尔有时能够成功显示出来,这是什么原因呢,手机是11.4.1系统的iPhone7

mrx102 #76 · July 30, 2019 作者
TD 回复

你点击一下灰色区域,如果日志里有post request err之类的话,那就是WDA没起来或者崩溃了,需要等到WDA重启成功才能再次使用

TD · #77 · July 30, 2019
Author only
mrx102 #78 · July 30, 2019 作者
TD 回复

你这个应该是一个设备起了多个xcodebuild,导致WDA不断的在重启。你在命令行执行 idevice_id -l ,看下是不是有两个相同的id?如果有的话,就把手机的wifi切换一下,不要跟mac连同一个wifi。如果没有,那就停掉ios-provider,杀掉所有的xcodebuild进程,然后重启ios-provider

TD · #79 · July 30, 2019
Author only
mrx102 #80 · July 30, 2019 作者
TD 回复

你从git上更新一下代码,可以通过参数--wda-port 8200 --wda-mjpeg-port 9200来修改WDA在手机上的端口号

mrx102 回复

好的,谢谢

无法识别这些选项:wda-path, wda-port 这是没有安装成功么?

mrx102 #83 · August 12, 2019 作者
stonerczl 回复

按照步骤安装依赖,配置WDA,然后拉取代码,切换到代码目录下,执行npm install&npm link,之后再执行stf local 或stf ios-provider

hello,想问下安装ipa包一直解析失败,就到Manifest那一步会报类似这种错误GET http://127.0.0.1:7100/s/apk/9aa06aa1-83d0-4441-97c7-b664e8590b06/upload_62dc4fb3c26ccaab5264030b51be788e.ipa/manifest net::ERR_EMPTY_RESPONSE,这个是安装包问题还是解析问题啊?我上传的包大小大约是180MB左右,看代码我打日志是走到了ipareader里unzip那一步,之后parsePlist就走不下去了,感觉unzip也没成功

mrx102 #85 · August 13, 2019 作者
Wang Wenbo 回复

看下后天日志有没有报错,把删除tmpdir那几句代码去掉吧。

mrx102 回复

日志没有相应的报错,我每一步打日志看,在ipareader unzipIPa方法里pipe那块好像就没执行了,但是也没有报错信息

mrx102 #87 · August 13, 2019 作者
Wang Wenbo 回复

可能你的文件太大,有试过其他的安装包吗?

mrx102 回复

试过一个45mb的也不行,是每个ipa包的结构不一样吗

mrx102 回复

找到原因了,不知道为啥unzip2和unzip都不好用,上网查了用了unzip-stream这个工具,就可以了


楼主,这个最新的是指什么,目前我的iphone XR安装应用遇到提示invalid UUID,需要下载最新的libimobiledevice,会有影响吗?http://www.bubuko.com/infodetail-3028133.html

mrx102 #91 · August 16, 2019 作者
TD 回复

现在应该没有那个问题了,你可以更新试一下

mrx102 回复

嗯嗯,试了没有问题

赞,请问这个开源的STF现在有docker镜像版了吗

mrx102 #94 · August 16, 2019 作者
isally 回复

没有,ios的不支持docker部署。你可以自己构建docker镜像用于部署主服务及Android

mrx102 回复

好的,谢谢,docker部署真是太方便了,Android的是已用 docker部署实现了,现在是还差iOS的还没解决方案

After run your source. The WDA already started:

The screenshot plugins worked

But the stream does not worked.

When i debug stream.js i saw chunk return from mjpegServer (port 9100 is forwarded to port 6104) is null

When i change the socket port (6104 - 1 = 6103), the touch plugin worked. I think there is problem with mjpegServer in WDA.

And the result when i ran http://localhost:6103/inspector (port 8100 is forwarded to port 6103)

Please help me. Thank you very much

mrx102 #97 · August 30, 2019 作者
nhunh585 回复

screenshot plugins is used idevicescreenshot to capture screen. not depend on WDA.
the first plugin device,the control port will be 6103,and the stream port is 6104,so the port is correct。
As for the inspector, there is a problem when executing bootstrap.sh to configure the WDA dependency. You can ignore it.
finally , What is the ios version of your phone? Now only supports versions above ios10。

When i change the socket port (6104 - 1 = 6103), the touch plugin worked (but stream still wont).

The ios version is 10.0.2.

Yes I remember when I ran bootstrap.sh, an error occurred. But why can I ignore it?

nhunh585 回复

now ios10.x is not support. it must be ios11.x or ios12.x.

For stf, the inspector function is not used,so just ignore it.if you really need it ,you can search for the error info to fix it.

mrx102 回复

thank you very much

101Floor has been deleted

Xcode用10.3的版本可以吗?

iphone 7 连上stf后,一直抛这个错误,看上去像是抓屏有问题,请教下要怎么处理,谢谢
(node:619) UnhandledPromiseRejectionWarning: Error: Input buffer contains unsupported image format
(node:619) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2231)
(node:619) UnhandledPromiseRejectionWarning: Error: VipsJpeg: Premature end of JPEG file

(node:619) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2232)
(node:619) UnhandledPromiseRejectionWarning: Error: Input buffer contains unsupported image format
(node:619) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2233)
(node:619) UnhandledPromiseRejectionWarning: TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.
at Function.Buffer.from (buffer.js:202:9)
at Sender.send (/Users/xuqq/src/stf/node_modules/ws/lib/Sender.js:277:23)
at WebSocket.send (/Users/xuqq/src/stf/node_modules/ws/lib/WebSocket.js:377:18)
at /Users/xuqq/src/stf/lib/units/ios-device/plugins/screen/stream.js:366:20
at send (/Users/xuqq/src/stf/lib/units/ios-device/plugins/screen/stream.js:357:20)
at sharp.resize.rotate.toBuffer.then.data (/Users/xuqq/src/stf/lib/units/ios-device/plugins/screen/stream.js:416:24)
at
(node:619) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2234)
(node:619) UnhandledPromiseRejectionWarning: Error: Input buffer contains unsupported image format
(node:619) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2235)
(node:619) UnhandledPromiseRejectionWarning: Error: Input buffer contains unsupported image format
(node:619) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2236)

mrx102 #105 · September 19, 2019 作者
raotongm 回复


先在这个地方加个catch,捕获异常吧。现在还没有彻底的解决方法

mrx102 回复

谢谢,我试下

楼主,想问下,可不可以在centos安装IOS集成?

iphonX ios11.2.2版本 RequestError: Error: socket hang up 打开屏幕黑屏

109Floor has been deleted
mrx102 #110 · September 20, 2019 作者
pcz88 回复

centos可以安装,但是不能启动ios-provider,也就是只能启动stf原有的模块,ios的必须在mac下才能启动

mrx102 #111 · September 20, 2019 作者
stonerczl 回复

是黑屏还是没有画面? 没有画面的话就要看详细日志

mrx102 回复

i2019-09-23T18:20:29.416Z INF/ios-device:plugins:wdaCommands 79596 [af12e7c16e83a3ef3688248668d480d150167098] post request err { RequestError: Error: socket hang up
at new RequestError (/Users/user/stf/node_modules/_request-promise-core@1.1.2@request-promise-core/lib/errors.js:14:15)
at Request.plumbing.callback (/Users/user/stf/node_modules/_request-promise-core@1.1.2@request-promise-core/lib/plumbing.js:87:29)
at Request.RP$callback as _callback
at self.callback (/Users/user/stf/node_modules/_request@2.88.0@request/request.js:185:22)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at Request.onRequestError (/Users/user/stf/node_modules/_request@2.88.0@request/request.js:881:8)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at Socket.socketOnEnd (_http_client.js:437:9)
at emitNone (events.js:111:20)
at Socket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickCallback (internal/process/next_tick.js:181:9)
name: 'RequestError',
message: 'Error: socket hang up',
cause: { Error: socket hang up
at createHangUpError (_http_client.js:342:15)
at Socket.socketOnEnd (_http_client.js:437:23)
at emitNone (events.js:111:20)
at Socket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickCallback (internal/process/next_tick.js:181:9) code: 'ECONNRESET' },
error: { Error: socket hang up
at createHangUpError (_http_client.js:342:15)
at Socket.socketOnEnd (_http_client.js:437:23)
at emitNone (events.js:111:20)
at Socket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickCallback (internal/process/next_tick.js:181:9) code: 'ECONNRESET' },
options:
{ method: 'POST',
uri: 'http://localhost:6349/wda/unlock',
body: {},
json: true,
headers: { 'Content-Type': 'application/json' },
callback: [Function: RP$callback],
transform: undefined,
simple: true,
resolveWithFullResponse: false,
transform2xxOnly: false },
response: undefined }

mrx102 #113 · September 23, 2019 作者
stonerczl 回复

你更新一下代码再试试,记得同步更新WDA的

mrx102 回复

更新了,看日志一直循环这样的,一直刷~~~

2019-09-24T18:25:54.322Z INF/ios-device:plugins:wdaProxy 17895 [af12e7c16e83a3ef3688248668d480d150167098] exit with code :208
2019-09-24T18:25:54.322Z INF/ios-device:plugins:wdaProxy 17895 [af12e7c16e83a3ef3688248668d480d150167098] start iproxy with params:6109 8100 af12e7c16e83a3ef3688248668d480d150167098
2019-09-24T18:25:54.329Z INF/ios-device:plugins:wdaProxy 17895 [af12e7c16e83a3ef3688248668d480d150167098] exit with code :208
2019-09-24T18:25:54.330Z INF/ios-device:plugins:wdaProxy 17895 [af12e7c16e83a3ef3688248668d480d150167098] start iproxy with params:6110 9100 af12e7c16e83a3ef3688248668d480d150167098

mrx102 #115 · September 24, 2019 作者
stonerczl 回复

这个是因为你的6109和6110端口被占了,命令行下执行killall iproxy

mrx102 回复

再问下,wda安装 运行./Scripts/bootstrap.sh,报错

Validating Inspector
Cannot find module 'eslint-config-appium'

安装eslint-config-appium后又报
Validating Inspector
appium:
Configuration for rule "indent" is invalid:
Value "data["1"].ImportDeclaration" has additional properties.
Value "off" is the wrong type.

这个怎么处理?

mrx102 #117 · September 27, 2019 作者
stonerczl 回复

https://github.com/appium/eslint-config-appium/issues/11
这个问题你也可以不用管他,这个只影响inspector的功能,对stf没有影响

118Floor has been deleted
mrx102 回复

ios 12.4.1 wda成功,也没报错,但是使用设备,黑屏

2019-10-11T01:28:58.756Z INF/ios-device:plugins:wdaProxy 816 [d90476478b2671c3cbe26b48c90a3f211d338a69] WDA启动成功
2019-10-11T01:28:58.770Z INF/ios-device:plugins:wdaProxy 816 [d90476478b2671c3cbe26b48c90a3f211d338a69] start WDA with params:build-for-testing,test-without-building,-project,/Users/user/Desktop/文档/script/WebDriverAgent/WebDriverAgent.xcodeproj,-scheme,WebDriverAgentRunner,-destination,id=d90476478b2671c3cbe26b48c90a3f211d338a69,platform=iOS,-configuration,Debug,IPHONEOS_DEPLOYMENT_TARGET=10.2
2019-10-11T01:29:04.893Z INF/ios-device:plugins:wdaProxy 816 [d90476478b2671c3cbe26b48c90a3f211d338a69] xcodebuild构建成功

/usr/local/bin/stf -> /usr/local/lib/node_modules/stf/bin/stf

zmq@2.15.3 install /usr/local/lib/node_modules/stf/node_modules/zmq
node-gyp rebuild

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

Traceback (most recent call last):
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 16, in
sys.exit(gyp.script_main())
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 545, in script_main
return main(sys.argv[1:])
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 538, in main
return gyp_main(args)
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 523, in gyp_main
generator.GenerateOutput(flat_list, targets, data, params)
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 2170, in GenerateOutput
part_of_all=qualified_target in needed_targets)
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 795, in Write
self.Pchify))
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1190, in WriteSources
cflags = self.xcode_settings.GetCflags(configname)
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 551, in GetCflags
archs = self.GetActiveArchs(self.configname)
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 420, in GetActiveArchs
xcode_archs_default = GetXcodeArchsDefault()
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 118, in GetXcodeArchsDefault
xcode_version, _ = XcodeVersion()
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1265, in XcodeVersion
version = re.match(r'(\d.\d.?\d*)', version).groups()[0]
AttributeError: 'NoneType' object has no attribute 'groups'
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack at emitTwo (events.js:125:13)
gyp ERR! stack at ChildProcess.emit (events.js:213:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:197:12)
gyp ERR! System Darwin 17.0.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/stf/node_modules/zmq
gyp ERR! node -v v8.1.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zmq@2.15.3 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the zmq@2.15.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
楼主,能不能看下,在安装STF这边出错了,按提示操作,还会出错哦

stonerczl 回复

启动了stf平台,wda会一直testing

我遇到啦。并且已经解决。解决方法是: ideviceimagemounter /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/12.1/DeveloperDiskImage.dmg /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/12.1/DeveloperDiskImage.dmg.signature

Author only

WebDriverAgentRunner-Runner(2301,0x16e3eb000) malloc: *** mach_vm_map(size=458752) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
控制一段时间后,图像会卡住,然后wda重启,看wda有部分是这个错误,这是什么原因

ios能不插线连接吗

126Floor has been deleted
stonerczl 回复

killall iproxy 我这个无效啊,你怎么解决的这个问题啊

mrx102 回复

大神,我这边试着./Scripts/bootstrap.sh -- e,遇到了Validating Inspector
Cannot find module 'eslint-config-appium'

安装eslint-config-appium后又报
Validating Inspector
appium:
Configuration for rule "indent" is invalid:
Value "data["1"].ImportDeclaration" has additional properties.
Value "off" is the wrong type.

没继续管它:试着去编译, xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=249589fe4a30f0d6a2b140b48321cbb328e20d51' test,报如下错误,提示缺少huya依赖:
Testing failed:
No profiles for 'com.huya.test.WebDriverAgentRunner.15' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.huya.test.WebDriverAgentRunner.15'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.
Code signing is required for product type 'UI Testing Bundle' in SDK 'iOS 11.4'
** TEST FAILED **

The following build commands failed:
Check dependencies
(1 failure)

需要 Sign In 后方可回复, 如果你还没有账号请点击这里 Sign Up