STF STF 集成 iOS 之 开源了

mrx102 · 2019年06月19日 · 最后由 Keyens 回复于 2024年03月29日 · 18613 次阅读
本帖已被设为精华帖!

前言

之前写了两篇关于 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,具体方法自行搜索。

启动 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

感谢

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

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

更新:

基于官方 2020.3.18 的版本集成 iOS,更新代码时请同步更新 WDA

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
共收到 162 条回复 时间 点赞

这个是替代 WebDriverAgent 的吗?

可以咨询下视频流获取的原理吗,谢谢~


请问,ios 安装.ipa 出现这个是为什么? 辨别不出来.ipa 后缀吗

纳人性张 回复

你这个怎么解决的

EasilyTest 回复

我遇到一摸一样的问题, 请问你怎么解决的?

请问一下,IOS 端用的是楼主的 3.4.1 版本的 stf,安卓端用的是 3.4.2 的版本,这样能连上的吗

想问下大神,这个只能用 nodejs8.x 的版本来进行安装吗?好麻烦啊,ios 上直接通过 brew install,最早的只能到 10,官方都好像终止了很多 8.x 的版本。

现在这个可以在 Linux 上实现 ios 的 stf 吗?

蓝蓝 回复

大佬你这个模拟器的问题解决吗

你好,请问这个解决了吗?怎么解决的帮忙提示一下

EasilyTest 回复

你好 ,你这个解决了吗,怎么解决的?,我也碰到这个问题了,帮忙提示一下

@mrx102 大神,目前的 wda 不支持 ios14.3 及 xcode12.3,appium 的 wda 最新版本已经支持了,啥时候有空帮忙看看哈

davidshang 回复

npm rebuild 一下试试

promise 回复

你好,你这个问题解决了吗? 遇到同样的问题了

这么好的方案,可以向 STF 提交 pr 呀!

丽丽 回复

请问下是把 stf 里面所有的 info.plist 文件格式都改了吗?谢谢!

cool stf+appium app 真机自动化平台实现 中提及了此贴 08月27日 22:17



识别成功但是打开的时候报错@mrx102,无法显示屏幕不断重连

只能在 mac 平台吗,还是可以在 linux 下搭建啊

迪文 回复

stf 这样改就能接模拟器了吗,我试了还是不行😂 😂

黑山老妖 回复

可尝试修改 stf lib>units>ios-device>plugins>wdaProxy.js 52 行

pro = new SubpPocess("iproxy",[localPort,remotePort,'-l','-s','127.0.0.1','-u',options.serial])

您好 文中提到的:配置好 WebDriverAgent,具体方法自行搜索。 是指用 xcode build 到真机

大神,现在 ios13.4 支持了吗?

大佬,你这个咋解决的哈

164楼 已删除

Hi,打扰了,首先很赞支持 STF IOS 开源项目!!!😁
我这边尝试使用 IOS 模拟器集成时,遇到了点小问题,麻烦可以给些建议。多谢!

该报错由于对象为空,获取 sdk 报错,发现 simctl list devices 的返回值中,前缀部分略有不同,修改了下并解决

现在 IOS 模拟器可以识别到了,但是发现 xcodebuild 构建了两次,点击对应设备 stream 后黑屏,并且报了错误。而后又开始重新识别设备了

Error: connect ECONNREFUSED 127.0.0.1:6104


可以给予下帮助,非常感谢!

mrx102 #162 · 2020年05月08日 Author
wadeyu 回复

前面应该有个 idevicescreenshot 的命令报错了,把那个命令拿出来单独执行,根据错误信息搜索解决

请教一下楼主 @mrx102 与各位大神:
我依照楼主的教程进行到最后一步,启动 STF 服务时遇到了一个问题,
当我输入指令时:stf local --public-ip 172.28.28.49 --wda-path /Users/test/Desktop/WebDriverAgent/ --wda-port 8100
会出现图片显示的错误

请问有人遇到过这个错误吗?怎么解决呢?再麻烦各位协助,谢谢
xcode:10.1
usb 已接上 ios 手机

请问下各路大侠,有比较好的方法与 jenkins 集成吗?

W52 回复

这个问题解决了吗,我也遇到了

mrx102 #158 · 2020年04月01日 Author

支持

现在支持 xcode11 了吗

mrx102 #156 · 2020年03月28日 Author
moonlin12 回复

iOS 不支持 docker 部署。只能在 mac 上下载源码部署

isally 回复

请问,你这个实现了吗

mrx102 回复

STF 的 Android 的已经部署在 mac 的 docker 上了,需要修改 STF 重新做 docker 镜像吗?
还是可以就把 IOS 的部分部署在 host 上?

153楼 已删除
mrx102 回复

请问下,现在是不是可以支持 Xcode11 的版本了???

大神,按步骤部署完,
执行启动命令 stf ios-provider。。报错
Each option can be be overwritten with an environment variable by converting the
option to uppercase, replacing dashes with underscores and prefixing it with
STF_PROVIDER_ (e.g. STF_PROVIDER_NAME).
Unexpected token ...
报错如下图

第二种启动方式,stf local 。。。

报错:
Each option can be be overwritten with an environment variable by converting the
Unexpected token ...
2020-01-03T09:51:14.672Z FTL/cli:local 79717 [] Child process had an error ExitError: Exit code "1"
at ChildProcess. (/usr/local/lib/node_modules/stf/lib/util/procutil.js:49:23)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
2020-01-03T09:51:14.676Z INF/cli:local 79717 [
] Shutting down all child processes
报错如下图

请问怎么解决

mrx102 #150 · 2019年12月26日 Author
promise 回复

支持的

这个能支持 ios13 版本吗

simple [精彩盘点] TesterHome 社区 2019 年 度精华帖 中提及了此贴 12月24日 22:45
mrx102 #146 · 2019年12月12日 Author
阿三 回复

忘记 import 头文件了,已经更新了

阿三 回复

我进入到 stf 的目录,执行了一下 npm install,多执行几次就好了

同遇到,请问你解决了吗

丽丽 回复

解决了,把 info.plist 文件的 xml 格式改成 binary 格式,就可以正常解析了

mrx102 回复

上述问题已经解决了,又来一个问题麻烦又时间帮我看看,就是 ipareader.js 文件解压并解析文件时报错,这个需要怎么处理,为什么不直接采用命令行来安装和卸载文件呢

137楼 已删除
136楼 已删除


我按照教程按照了,npm install 也没有报错,然后启动的时候报一堆错误,是需要重新再安装 sudo npm install -g stf 吗?还是别的步骤不对

stf 支持 iOS13 吗

丽丽 回复

命令后加-d

mrx102 #132 · 2019年11月19日 Author
丽丽 回复

用 xcode 打开 WDA 项目,配置好你们的证书,在 build setting 里面修改 bundle identifier

楼主,这个问题怎么处理

黑山老妖 回复

@ 黑山老妖 你遇到的这个问题处理了吗,我目前遇到的问题和你的一样,求助

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)

stonerczl 回复

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

126楼 已删除

ios 能不插线连接吗

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 有部分是这个错误,这是什么原因

仅楼主可见

我遇到啦。并且已经解决。解决方法是: 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

stonerczl 回复

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

/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 这边出错了,按提示操作,还会出错哦

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 构建成功

118楼 已删除
mrx102 #117 · 2019年09月27日 Author
stonerczl 回复

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

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 #115 · 2019年09月24日 Author
stonerczl 回复

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

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 #113 · 2019年09月23日 Author
stonerczl 回复

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

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 #111 · 2019年09月20日 Author
stonerczl 回复

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

mrx102 #110 · 2019年09月20日 Author
pcz88 回复

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

109楼 已删除

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

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

mrx102 回复

谢谢,我试下

mrx102 #105 · 2019年09月19日 Author
raotongm 回复


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

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)

Xcode 用 10.3 的版本可以吗?

101楼 已删除
mrx102 回复

thank you very much

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.

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?

mrx102 #97 · 2019年08月30日 Author
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。

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 回复

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

mrx102 #94 · 2019年08月16日 Author
isally 回复

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

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

mrx102 回复

嗯嗯,试了没有问题

mrx102 #91 · 2019年08月16日 Author
TD 回复

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


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

mrx102 回复

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

mrx102 回复

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

mrx102 #87 · 2019年08月13日 Author
Wang Wenbo 回复

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

mrx102 回复

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

mrx102 #85 · 2019年08月13日 Author
Wang Wenbo 回复

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

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 #83 · 2019年08月12日 Author
stonerczl 回复

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

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

mrx102 回复

好的,谢谢

mrx102 #80 · 2019年07月30日 Author
TD 回复

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

TD · #79 · 2019年07月30日
仅楼主可见
mrx102 #78 · 2019年07月30日 Author
TD 回复

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

TD · #77 · 2019年07月30日
仅楼主可见
mrx102 #76 · 2019年07月30日 Author
TD 回复

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

mrx102 回复

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

mrx102 #74 · 2019年07月29日 Author
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

TD · #73 · 2019年07月29日
仅楼主可见
mrx102 回复

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

mrx102 #71 · 2019年07月29日 Author
TD 回复

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

mrx102 回复

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

mrx102 #69 · 2019年07月29日 Author
TD 回复

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

plugin.startWda()
return plugin;

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

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



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

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 页面能够登录,但是打开没有内容,谁知道是什么原因吗

感谢作者分享。

mrx102 #64 · 2019年07月09日 Author

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

63楼 已删除
mrx102 #62 · 2019年07月09日 Author

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

61楼 已删除
mrx102 #60 · 2019年07月09日 Author


inspector 报错没关系,不影响

59楼 已删除
mrx102 #58 · 2019年07月04日 Author

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

mrx102 #57 · 2019年07月04日 Author
TD 回复

版本太高了,用旧的版本

mrx102 回复

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

mrx102 回复

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

mrx102 回复

好的,谢谢楼主的开源👍

mrx102 #53 · 2019年07月04日 Author
蓝蓝 回复

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

mrx102 #52 · 2019年07月04日 Author
TD 回复

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

蓝蓝 回复

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

SCH 回复

xcode 10.1

蓝蓝 回复

你是用的 xcode 几?

分享我安装过程中遇到的一些问题
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

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

TD · #46 · 2019年07月03日
仅楼主可见


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

mrx102 #44 · 2019年07月02日 Author
TangoWong1983 回复

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

mrx102 #43 · 2019年07月02日 Author
stronger 回复

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

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


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

mrx102 #40 · 2019年07月02日 Author
W52 回复

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


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

mrx102 #38 · 2019年07月02日 Author
TangoWong1983 回复

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


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

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

36楼 已删除

厉害厉害👍 👍 👍

mrx102 #34 · 2019年07月01日 Author
grizz 回复

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

mrx102 #33 · 2019年07月01日 Author
Xu Wang 回复

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

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

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

30楼 已删除
mrx102 #29 · 2019年06月27日 Author
TD 回复

发详细日志

Jacc 专栏文章:[该话题已被删除] 中提及了此贴 06月27日 12:01
27楼 已删除
mrx102 回复

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

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

琉丶言 STF 集成 iOS 之源码分析 中提及了此贴 06月25日 18:58
23楼 已删除
mrx102 #21 · 2019年06月21日 Author
TD 回复

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

仅楼主可见

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

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

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

作者帅的一 P 👍

鼓励开源项目!

simple 将本帖设为了精华贴 06月20日 13:58
13楼 已删除
codeskyblue 回复

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

赞赞赞!感谢开源!

琉丶言 回复

来个视频或 gif 看看效果

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

先赞一个

赞一个,一会试试

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

我第一个顶,点赞

mrx102 STF 集成 iOS 之设备连接 中提及了此贴 06月19日 18:02
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册