最早知道 WebDriverAgent 还是通过社区里的一篇文章 WebDriverAgent 简介(PS:社区真是伟大,什么都有)
通过这篇文章希望能让初次接触 WDA 的你,少走一些弯路。
WDA 在 Github 的首页上有一个很简单的安装说明 https://github.com/appium/WebDriverAgent,参考这个,我再增加一些配图,以及自己使用过程中的一些体会。
尽量升级 Xcode 到最新版,保持 iPhone 的版本大于 9.3
从 github 上下载代码
git clone https://github.com/appium/WebDriverAgent
运行初始化脚本
./Scripts/bootstrap.sh
该脚本会使用Carthage下载所有的依赖,使用 npm 打包响应的 js 文件
执行完成后,直接双击打开WebDriverAgent.xcodeproj
这个文件。
因为安装到真机上都是需要证书签名的,用免费的证书我没有搞定,最后用的还是 99 美元的开发者证书。
画圈的地方,从左向右依次点击。最后 Team 那一栏,选择你买到的开发者证书帐号。(个人证书也可以)
接着在 TARGETS 里面选中 WebDriverAgentRunner,用同样的方法设置好证书
如果是免费版的个人证书,还需要修改下 WebDriverAgent 的 BundleID,随便加点后缀,只要不跟其他人的重名就好(这里参考了 macaca 的一篇文章 https://testerhome.com/topics/8085 )
菜单栏选择目标设备
Scheme 选择 WebDriverAgentRunner
最后运行 Product -> Test
一切正常的话,手机上会出现一个无图标的 WebDriverAgent 应用,启动之后,马上又返回到桌面。这是很正常的不要奇怪。
此时控制台界面可以看到设备的 IP。如果看不到的话,使用这种方法打开
常见问题
问题 1:
解决方法:
遇到这个问题,说明手机上已经有一个 WebDriverAgent 的应用了,只是 BundleID 不一致,需要先将手机上的卸载掉,重新运行 Product -> Test
问题 2:
解决方法:
提示其实已经说了,进入 设置
通用
设备管理
开发者应用
然后点击信任
,之后再重新运行一遍 Product -> Test
有些国产的 iPhone 机器通过手机的 IP 和端口还不能访问,此时需要将手机的端口转发到 Mac 上。
# 使用--HEAD安装最新版本
$ brew install libimobiledevice --HEAD
$ iproxy 8100 8100
使用iproxy --help
可以查到更具体的用法。 这时通过访问http://localhost:8100/status
确认 WDA 是否运行成功。
而 inspector 的地址是http://localhost:8100/inspector
, inspector 是用来查看 UI 的图层,方便写测试脚本用的
通常来说为了持续集成,能够全部自动化比较好一些
# 解锁keychain,以便可以正常的签名应用,
PASSWORD="replace-with-your-password"
security unlock-keychain -p $PASSWORD ~/Library/Keychains/login.keychain
# 获取设备的UDID
UDID=$(idevice_id -l | head -n1)
# 运行测试
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination "id=$UDID" test
论坛里有帖子说要修改 BundleID,我试了试,就算不改也挺正常的。
还有一些奇怪的问题,比如
这个应该是脚本有问题,解决方式就是删掉点代码
function fetch_and_build_dependencies() {
echo -e "${BOLD}Fetching dependencies"
assert_has_carthage
if ! cmp -s Cartfile.resolved Carthage/Cartfile.resolved; then
runtimes_with_devices=`xcrun simctl list -j devices | python -c "import sys,json;print(' '.join(map(lambda x: x[0], filter(lambda x: len([y for y in x[1] if y.get('availability') == '(available)' or y.get('isAvailable')]) > 0, json.load(sys.stdin)['devices'].items()))))"`
platforms=(iOS)
if echo "$runtimes_with_devices" | grep -q tvOS; then
platforms+=(tvOS)
else
echo "tvOS platform will not be included into Carthage bootstrap, because no Simulator devices have been created for it"
fi
platform_str=$(join_by , "${platforms[@]}")
carthage bootstrap $USE_SSH --platform "$platform_str" $NO_USE_BINARIES
cp Cartfile.resolved Carthage
else
echo "Dependencies up-to-date"
fi
}
改成
function fetch_and_build_dependencies() {
echo -e "${BOLD}Fetching dependencies"
assert_has_carthage
if ! cmp -s Cartfile.resolved Carthage/Cartfile.resolved; then
platforms=(iOS)
platform_str=$(join_by , "${platforms[@]}")
carthage bootstrap $USE_SSH --platform "$platform_str" $NO_USE_BINARIES
cp Cartfile.resolved Carthage
else
echo "Dependencies up-to-date"
fi
}
Failed to authorize rights (0x1) with status: -60007
The bundle “WebDriverAgentRunner” couldn’t be loaded because it is damaged or missing necessary resources
在这个官网 Wiki 里面可以找到解决办法 https://github.com/facebook/WebDriverAgent/wiki/Common-Issues
如果汗流浃背,弄了很久还是没搞定。尝试下这些步骤
git pull
更新 WebDriverAgent 的代码最后附上基于 Python 自动化框架地址
Xcode 问题多多,愿 WDA 与你同在。
运行 xcodebuild 遇到下面这个错误
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
执行 sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
就可以修复。See also: https://github.com/nodejs/node-gyp/issues/569
近段时间发现 facebook/WebDriverAgent 已经 archived 了(也就是不维护了),目前推荐用 appium 的 fork 版
最近安装 libimobiledevice 似乎不好使了,看网上说可以用下面的命令
brew update
brew uninstall --ignore-dependencies libimobiledevice
brew uninstall --ignore-dependencies usbmuxd
brew install --HEAD usbmuxd
brew unlink usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
build WDA 的时候提示 Command CodeSign failed with a nonzero exit code
改了 Bundle Id 依然不行,请问是什么原因呢
在 Windows 上有没有办法 build 和 test WDA?
不出 ip 怎么办?
2020-09-05 12:52:29.109669+0800 WebDriverAgentRunner-Runner[2775:170933] Running tests...
Test Suite 'All tests' started at 2020-09-05 12:52:31.888
Test Suite 'WebDriverAgentRunner.xctest' started at 2020-09-05 12:52:31.889
Test Suite 'UITestingUITests' started at 2020-09-05 12:52:31.889
Test Case '-[UITestingUITests testRunner]' started.
t = 0.00s Start Test at 2020-09-05 12:52:31.895
t = 0.00s Set Up
2020-09-05 12:52:31.896044+0800 WebDriverAgentRunner-Runner[2775:170933] -[UITestingUITests internalImplementation]: unrecognized selector sent to instance 0x281278f00
t = 0.04s Assertion Failure: :0: failed: caught "NSInvalidArgumentException", "-[UITestingUITests internalImplementation]: unrecognized selector sent to instance 0x281278f00"
(
0 CoreFoundation 0x0000000181f465c0 472E7FDE-A97B-3175-B6EA-87A1B78AEA02 + 1185216
1 libobjc.A.dylib 0x0000000195f5042c objc_exception_throw + 60
2 CoreFoundation 0x0000000181e50a2c 472E7FDE-A97B-3175-B6EA-87A1B78AEA02 + 178732
3 CoreFoundation 0x0000000181f49130 472E7FDE-A97B-3175-B6EA-87A1B78AEA02 + 1196336
4 CoreFoundation 0x0000000181f4b420 _CF_forwarding_prep_0 + 96
5 WebDriverAgentLib 0x000000010924dea4 -[FBFailureProofTestCase setUp] + 136
6 XCTest 0x000000010528d1ac __48-[XCTestCase _performSetUpSequenceWithSelector:]_block_invoke_2 + 516
7 XCTest 0x00000001052e4958 +[XCTestCase(Failures) performFailableBlock:testCase:testCaseRun:shouldInterruptTest:] + 92
8 XCTest 0x00000001052e4854 -[XCTestCase(Failures) _performTurningExceptionsIntoFailuresInterruptAfterHandling:block:] + 136
9 XCTest 0x000000010528cf88 __48-[XCTestCase _performSetUpSequenceWithSelector:]_block_invoke + 132
10 XCTest 0x00000001052f6e64 -[XCTContext _runActivityNamed:type:block:] + 256
11 XCTest 0x0000000105295c0c -[XCTestCase startActivityWithTitle:type:block:] + 204
12 XCTest 0x0000000105295dc4 -[XCTestCase startActivityWithTitle:block:] + 76
13 XCTest 0x000000010528cef4 -[XCTestCase _performSetUpSequenceWithSelector:] + 124
14 XCTest 0x000000010528b18c -[XCTestCase invokeTest] + 732
15 XCTest 0x000000010528cda0 __26-[XCTestCase performTest:]_block_invoke_2 + 48
16 XCTest 0x00000001052e4958 +[XCTestCase(Failures) performFailableBlock:testCase:testCaseRun:shouldInterruptTest:] + 92
17 XCTest 0x00000001052e4854 -[XCTestCase(Failures) _performTurningExceptionsIntoFailuresInterruptAfterHandling:block:] + 136
18 XCTest 0x000000010528ccd4 __26-[XCTestCase performTest:]_block_invoke.370 + 112
19 XCTest 0x00000001052f75a0 +[XCTContext runInContextForTestCase:block:] + 220
20 XCTest 0x000000010528c59c -[XCTestCase performTest:] + 580
21 XCTest 0x00000001052d18e8 -[XCTest runTest] + 64
22 XCTest 0x0000000105286870 __27-[XCTestSuite performTest:]_block_invoke + 272
23 XCTest 0x00000001052860d4 __59-[XCTestSuite _performProtectedSectionForTest:testSection:]_block_invoke + 48
24 XCTest 0x00000001052f75a0 +[XCTContext runInContextForTestCase:block:] + 220
25 XCTest 0x0000000105286070 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 172
26 XCTest 0x00000001052863e8 -[XCTestSuite performTest:] + 336
27 XCTest 0x00000001052d18e8 -[XCTest runTest] + 64
28 XCTest 0x0000000105286870 __27-[XCTestSuite performTest:]_block_invoke + 272
29 XCTest 0x00000001052860d4 __59-[XCTestSuite _performProtectedSectionForTest:testSection:]_block_invoke + 48
30 XCTest 0x00000001052f75a0 +[XCTContext runInContextForTestCase:block:] + 220
31 XCTest 0x0000000105286070 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 172
32 XCTest 0x00000001052863e8 -[XCTestSuite performTest:] + 336
33 XCTest 0x00000001052d18e8 -[XCTest runTest] + 64
34 XCTest 0x0000000105286870 __27-[XCTestSuite performTest:]_block_invoke + 272
35 XCTest 0x00000001052860d4 __59-[XCTestSuite _performProtectedSectionForTest:testSection:]_block_invoke + 48
36 XCTest 0x00000001052f75a0 +[XCTContext runInContextForTestCase:block:] + 220
37 XCTest 0x0000000105286070 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 172
38 XCTest 0x00000001052863e8 -[XCTestSuite performTest:] + 336
39 XCTest 0x00000001052d18e8 -[XCTest runTest] + 64
40 XCTest 0x0000000105309fa0 __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke + 180
41 XCTest 0x000000010530a0ac __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke.100 + 116
42 XCTest 0x00000001052a1038 -[XCTestObservationCenter _observeTestExecutionForBlock:] + 596
43 XCTest 0x0000000105309d28 -[XCTTestRunSession runTestsAndReturnError:] + 620
44 XCTest 0x000000010526a3f0 -[XCTestDriver runTestsAndReturnError:] + 444
45 XCTest 0x00000001052f33a0 _XCTestMain + 2400
46 WebDriverAgentRunner-Runner 0x0000000104eff818 -[_XCTRunnerAppDelegate applicationWillResignActive:] + 0
47 WebDriverAgentRunner-Runner 0x0000000104eff720 _XCTRunnerRunTests + 0
48 CoreFoundation 0x0000000181ec3564 472E7FDE-A97B-3175-B6EA-87A1B78AEA02 + 648548
49 CoreFoundation 0x0000000181ec27b8 472E7FDE-A97B-3175-B6EA-87A1B78AEA02 + 645048
50 CoreFoundation 0x0000000181ebcd34 472E7FDE-A97B-3175-B6EA-87A1B78AEA02 + 621876
51 CoreFoundation 0x0000000181ebc4bc CFRunLoopRunSpecific + 600
52 GraphicsServices 0x00000001988c2820 GSEventRunModal + 164
53 UIKitCore 0x00000001848608e0 CDE437AC-60AE-387A-95A4-24CB0671F41F + 12048608
54 UIKitCore 0x0000000184865fbc UIApplicationMain + 168
55 WebDriverAgentRunner-Runner 0x0000000104eff9e4 main + 192
56 libdyld.dylib 0x0000000181b83e60 0F500965-DBFB-3D2F-A47E-E9ECD430D3DD + 3680
)
t = 0.04s Tear Down
Test Case '-[UITestingUITests testRunner]' failed (0.037 seconds).
Test Suite 'UITestingUITests' failed at 2020-09-05 12:52:31.931.
Executed 1 test, with 1 failure (1 unexpected) in 0.037 (0.042) seconds
Test Suite 'WebDriverAgentRunner.xctest' failed at 2020-09-05 12:52:31.932.
Executed 1 test, with 1 failure (1 unexpected) in 0.037 (0.043) seconds
Test Suite 'WebDriverAgentLib.framework' started at 2020-09-05 12:52:31.932
Test Suite 'WebDriverAgentLib.framework' passed at 2020-09-05 12:52:31.932.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite 'All tests' failed at 2020-09-05 12:52:31.932.
Executed 1 test, with 1 failure (1 unexpected) in 0.037 (0.044) seconds
Error connecting to device! 这个错误你解决了吗?是需要更换数据线还是苹果系统的原因呢
xcodebuild failed with code 65
求助,Xcode 里显示 build success 但是 尝试走一个 test case 就变成这样子了。。。。
我到最后一步 运行 然后真机已经加载了一个没图标的 webDriverAgent,但是一直打不开 然后就报错:assertMacros.....
等了超级久还一直报相同的错误
求大神指点迷津,安装了一个多礼拜,断断续续 过五关斩六将的 最后一步还是有问题
还是不行,下载到 WebDriverAgent 文件夹,初始化脚本,最后的代码是{
"value" : "Invalid parameter not satisfying: path\n\n(\n\t0 CoreFoundation ,很长一段,看来只好下载 fackbook 的 appium
git clone https://github.com/appium/WebDriverAgent
git reset --hard 1eb3280d89e3510845efb5d1f398001313c2615b
能回退到 appium 带 inspector 版本,我其实是直接用之前装的 appium 看了。。
666,appium 分支的 inspector 可以分享下,折腾了半天,原来·······
git clone https://github.com/facebook/WebDriverAgent
后面多了 inspector,不过今天亲测这个 inspector 不好用,用回 appium 的 inspector 了
你的地址不行了,麻烦更新下哦
git clone https://github.com/appium/WebDriverAgent
appium 两个月前去掉了 inspector,如果是从 appium 这个分支下载的,inspector 当然没有
如果成功运行完./Scripts/bootstrap.sh 在当前目录没有找到 Inspector 这个目录,十有八九是这个问题。。
改用这个 git clone https://github.com/facebook/WebDriverAgentinspector,我这里改后解决了 unhandled endpoint
WDA test 可以在 xcode 里面跑起来,但是 python3 main.py -s $SERVER_URL 了以后就不行了,开始设备离线,然后就没有了,是怎么回事呢
{
"value" : "Unhandled endpoint: \/inspector -- http:\/\/localhost:8100\/ with parameters {\n wildcards = (\n inspector\n );\n}",
"sessionId" : "AAAA4EF9-D317-4EEE-AB08-3C7AEDD84948",
"status" : 1
}
http://localhost:8100/statushttp://localhost:8100/source 正常,和
但是访问 http://localhost:8100/inspector 的显示内容和访问 http://localhost:8100 的内容差不多,并没有出现 inspector 的界面
我也是
使用 “http://localhost:8100/staus” 和 “http://localhost:8100/source” 都有数据返回,并且返回的内容都是对的,但是在浏览器里打开 “http://localhost:8100/inspector” ,页面显示空白,没有任何信息
请问有大神和我情况一样吗?求解
请问 iproxy 总是连接手机失败是怎么回事呢?
楼主你好,我发现这两天 webDriverAgent 突然不能用免费证书了,楼主是否有遇到呢?
多谢楼主,搞定!
{
"value" : {
"state" : "success",
"os" : {
"name" : "iPhone OS",
"version" : "9.2.1",
"sdkVersion" : "11.2"
},
"ios" : {
"simulatorVersion" : "9.2.1",
"ip" : null
},
"build" : {
"time" : "Jan 8 2019 16:43:40",
"productBundleIdentifier" : "com.facebook.WebDriverAgentRunner"
}
},
"sessionId" : "EFB2B5B5-AED7-4B10-AB10-9AC29731DFE7",
"status" : 0
}
我显示这样,连接显示成功了,但是手机屏幕不显示,显示的都是代码,求大神助攻
我想请问一下各位大神,如果是我在 VMware 虚拟机下进行的操作,步骤全部成功,status 也可以访问,我应该怎么在 win 上连接这个服务呢,ping 虚拟机的 ip 可以 ping 成功,而且端口都已经打开了,我应该怎么设置才能在 win 下进行自动化开发,而不是在 mac 虚拟机下进行
但是可能页面刷新出不来:
$ brew install libimobiledevice --HEAD
$ iproxy 8100 8100
但是会提示你需要更新:
Warning: libimobiledevice HEAD-26373b3_2 is already installed and up-to-date
To reinstall HEAD_3, run brew reinstall libimobiledevice
$ brew reinstall libimobiledevice <==执行这个就可以了
真机时督察看不了系统页面
问下楼主安装 libimobiledevice 没有 iproxy 这个功能了,可以告知安装的 libimobiledevice 版本是多少么,我的版本为 HEAD-26373b3_2
这个帖子仔细看可以学到很多知识
请问下为什么会有 error connecting to device,刚重装了一边发现在 test 的时候 building succeded,但是 test failed
2018-04-18 21:25:31.896962+0800 WebDriverAgentRunner-Runner[316:10522] +[CATransaction synchronize] called within transaction
2018-04-18 21:25:31.964275+0800 WebDriverAgentRunner-Runner[316:10522] Running in the background.
2018-04-18 21:25:31.972787+0800 WebDriverAgentRunner-Runner[316:10522] Running tests...
2018-04-18 21:25:32.175900+0800 WebDriverAgentRunner-Runner[316:10522] 未能载入软件包 “WebDriverAgentRunner”,因为它已损坏或丢失必要的资源。 请尝试重新安装软件包。
2018-04-18 21:25:32.176092+0800 WebDriverAgentRunner-Runner316:10522
以后遇到问题先在 github webdriveragent 上面查一下就有了。。。
https://github.com/facebook/WebDriverAgent/issues/845
@weamylady 求大神解答,我现在实机 iOS 9.3.2 连接正常,screenshot 截图时报错 File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/wda/init.py", line 295, in screenshot
value = self.http.get('screenshot').value
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/wda/init.py", line 101, in fetch
return self.fetch_no_alert(method, url, data)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/wda/init.py", line 107, in _fetch_no_alert
return httpdo(target_url, method, data)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/wda/init_.py", line 83, in httpdo
raise WDAError(r.status, r.value)
wda.WDAError: WDAError(status=13, value=To screenshot a frame, it must have non-0 area.请问该如何解决
现在遇到一个问题 就是 ipad 横屏时 通过 screenshot 接口获取的截图还是竖屏的
IOS 9.3 OS 10.13.4 IPAD WEBDRIVERAGENT 最新代码
@weamylady 大神求解决
runner 也要选 team 哈 不然会报错
我把 iproxy 8100 8100 到 localhost 之后,频繁掉线,而且 inspector 的反应非常慢,十分抓狂。
特别提示:在执行./Scripts/bootstrap.sh 命令时,需要 cd 到 WebDriverAgent 目录下执行,并且使用 sudo
执行更改签名不重复时,AgentLib 不需要改,仅需改 Runner 就行
重新安装下 appium 和配置 WebDriverAgent(建议使用付费版开发者账号)就可以了,可以参照:https://testerhome.com/topics/8375
不知道是否遇到过一下情况:
使用 xcode 运行正常,然后在 console 获得
192.168.59.112:8100 这个信息
在浏览器中访问 http:192.168.59.112/status 时,一直在加载;
已经安装了 imobiledevice,并且使用 iproxy 进行设置,这个问题依然存在。。。
卡在 webdriveragent 启动了,别人都是启动的 8100,我这边直接启动的 0 端口。。
2017-11-23 17:12:41.908748+0800 WebDriverAgentRunner-Runner[487:102322] Built at Nov 21 2017 13:57:28
2017-11-23 17:12:41.984063+0800 WebDriverAgentRunner-Runner[487:102322] ServerURLHere->http://11.1.1.104:0<-ServerURLHere
模拟器安装了 webdriveragent 后,我获取不了 ip 地址,求助大佬
http://10.242.43.120:8100/status,访问一直是超时状态,已经参考文章方法将端口转发了,还是不好使,求指教
➜ ~ iproxy 8100 8100
waiting for connection
主要我最开始是直接输入./Scripts/bootstrap.sh ,依赖下载不下来
后面
mkdir -p Resources/WebDriverAgent.bundle
sh ./Scripts/bootstrap.sh
就能下载依赖了,而使用就要靠重启 iPhone 了
soga,其实大神的 wdaproxy 我也用过,但是 WDA 有一部分,真机总是使用不了,报错为 operation never finished bootstrapping,本来根据我的方法重启后已经能够运行 WDA 了,但是 wdaproxy 还是显示 502 Bad,不知道是不是需要连接到什么?
这个很简单,给你一段代码参考一下,是论坛大神写的 wdaproxy 上的:
https://github.com/openatx/wdaproxy
tap: function(x, y) {
var self = this;
return $.ajax({
url: "/session/" + self.sessionId + "/wda/tap/0",
method: "POST",
data: JSON.stringify({
x: x,
y: y
}),
}).then(function(ret) {
if (ret.status !== 0) {
console.log(ret.value);
} else {
return "Success";
}
})
},
initScreenSize: function() {
$.\
({
url: "/status",
})
.then(function(ret) {
this.sessionId = ret.sessionId;
return $.ajax({
url: "/session/" + ret.sessionId + "/window/size",
})
}.bind(this))
.then(function(ret) {
this.display.width = ret.value.width;
this.display.height = ret.value.height;
}.bind(this))
},
目前技术上的难点已经解决,看了 ios minicap 源码,直接连接它的服务端不停发截图过来就可以回显了。WebdriverAgent 也可以直接用 WebSocket 通讯发送命令就行了。就是现在缺少技术栈~~还需要人力和时间啊!有空多交流交流
我也是用开发者账号证书打包的。。。
我大概解决了这个问题,方法在这里 https://testerhome.com/topics/9666 不知道还有其他解决方案没有。
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}
Testing failed:
Test target WebDriverAgentRunner encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted)
这个错误怎么解决啊,我看文档说要信任 WebDriverAgentRunner ,但是我手机根本在设备管理就没发现 WebDriverAgentRunner 的证书啊??求指点
安装依赖会报错:
./Scripts/bootstrap.sh
Fetching dependencies
Building Inspector
Creating bundle directory...
Fetching Inspector dependencies...
npm WARN deprecated css-list@0.1.3: Deprecated.
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN web-driver-inspector@1.0.0 No repository field.
npm ERR! code EINTEGRITY
npm ERR! sha1-iXSDlvnXQZ1fon3ztIhy2tv4MYo= integrity checksum failed when using sha1: wanted sha1-iXSDlvnXQZ1fon3ztIhy2tv4MYo= but got sha1-xS7cVf1/ntQkN1oDgj2kv8mwIMk=. (152617 bytes)
求一发解决方案
这个我最早就试过用个人证书,也更改了 BundleID,没效果。
后来我又更换成企业证书,也改了 BundleID,还是没效果。
今天把 Xcode 升级到 8.3.3,也还是一样的错误。
我用 macaca 的 XCTestWD,还是这个问题,绕不过去的坎,心塞。
使用 “http://localhost:8100/staus” 和 “http://localhost:8100/source” 都有数据返回,并且返回的内容都是对的,但是在浏览器里打开 “http://localhost:8100/inspector” ,页面显示空白,没有任何信息。
从端口输出看到的错误如下:
accepted connection, fd = 4
waiting for connection
accepted connection, fd = 6
waiting for connection
Number of available devices == 1
Requesting connecion to device handle == 1 (serial: a43c429e49bb9862d018b9ee39c662c0d4cc6481), port 8100
Number of available devices == 1
Requesting connecion to device handle == 1 (serial: a43c429e49bb9862d018b9ee39c662c0d4cc6481), port 8100
run_ctos_loop: fd = 6
run_ctos_loop: fd = 4
run_stoc_loop: fd = 6
run_stoc_loop: fd = 4
recv failed: Resource temporarily unavailable
recv failed: Resource temporarily unavailable
recv failed: Operation not permitted
MAC 系统版本是 10.12,iOS 版本 10.2,Xcode 版本是 8.3,辛苦大神帮忙看下是什么问题
请问您的这个 xctest 的问题解决了吗?我买了开发者账号之后也卡在这里了,网上找了很多资料,对 xctest.framework 重签名也没用,请问有解决方案了吗? 万分感谢
无论真机还是模拟器运行都提示这个,求大神帮助呀~~
虚拟机里可以跑成功,真机不行。
跑模拟器 Xcode Debug 的 log:
2017-04-06 13:47:40.352 XCTRunner[4833:113945] Running tests...
2017-04-06 13:47:48.499 XCTRunner[4833:113945] Continuing to run tests in the background with task ID 1
Test Suite 'All tests' started at 2017-04-06 13:47:48.672
Test Suite 'WebDriverAgentLib.framework' started at 2017-04-06 13:47:48.674
Test Suite 'WebDriverAgentLib.framework' passed at 2017-04-06 13:47:48.674.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.001) seconds
Test Suite 'WebDriverAgentRunner.xctest' started at 2017-04-06 13:47:48.676
Test Suite 'UITestingUITests' started at 2017-04-06 13:47:48.677
Test Case '-[UITestingUITests testRunner]' started.
t = 0.00s Start Test at 2017-04-06 13:47:48.678
t = 0.00s Set Up
2017-04-06 13:47:48.685 XCTRunner[4833:113945] Built at Apr 6 2017 11:53:41
2017-04-06 13:47:48.705 XCTRunner[4833:113945] ServerURLHere->http://192.168.199.187:8100<-ServerURLHere
t = 47.95s Find the Application "local.pid.4769" 0x6080002a69c0
t = 47.95s Snapshot accessibility hierarchy for local.pid.4769
本地访问 server 后返回:
{
"value" : "Unhandled endpoint: \/ -- http:\/\/192.168.199.187:8100\/ with parameters {\n wildcards = (\n \"\"\n );\n}",
"sessionId" : "41A81AA0-6090-4419-9D81-C1EFA27ACD59",
"status" : 1
}
本地访问 status 返回:
{
"value" : {
"state" : "success",
"os" : {
"name" : "iOS",
"version" : "10.3"
},
"ios" : {
"simulatorVersion" : "10.3",
"ip" : "192.168.199.187"
},
"build" : {
"time" : "Apr 6 2017 11:53:42"
}
},
"sessionId" : "41A81AA0-6090-4419-9D81-C1EFA27ACD59",
"status" : 0
}
本地访问 inspector 截图:
跑真机时 Xcode Debug 的 Log:
dyld: Library not loaded: @rpath/XCTest.framework/XCTest
Referenced from: /var/containers/Bundle/Application/67D95C0C-0253-4654-A88B-1C646458E939/WebDriverAgentRunner-Runner.app/XCTRunner
Reason: no suitable image found. Did find:
/private/var/containers/Bundle/Application/67D95C0C-0253-4654-A88B-1C646458E939/WebDriverAgentRunner-Runner.app/Frameworks/XCTest.framework/XCTest: code signing blocked mmap() of '/private/var/containers/Bundle/Application/67D95C0C-0253-4654-A88B-1C646458E939/WebDriverAgentRunner-Runner.app/Frameworks/XCTest.framework/XCTest'
/private/var/containers/Bundle/Application/67D95C0C-0253-4654-A88B-1C646458E939/WebDriverAgentRunner-Runner.app/Frameworks/XCTest.framework/XCTest: code signing blocked mmap() of '/private/var/containers/Bundle/Application/67D95C0C-0253-4654-A88B-1C646458E939/WebDriverAgentRunner-Runner.app/Frameworks/XCTest.framework/XCTest'
(lldb)
试过很多方法,现在怀疑是 Xcode 的问题
虽然我的 Xcode 从 8.2.1 升级到了 8.3,iOS 从 10.0.2 升级到了 10.3 和 10.3.1,但都没有解决:(
https://github.com/facebook/WebDriverAgent/issues/429
https://github.com/facebook/WebDriverAgent/issues/521
现在我该怎么办?
大赞,成功了
得到的 IP 打不开
不用 xcodebuild tools,而从 gui 到 xcode 里运行测试的话,报错如下,说明还没有到运行 bootstrap 的程度,payload 就挂了。
dyld: Library not loaded: @rpath/XCTest.framework/XCTest
github 上有人提了这个 issue,但是被关闭了,说升级到 1.6.4 可以。但是我这不行啊。
https://github.com/Carthage/Carthage/issues/756
dyld: Library not loaded: @rpath/XCTest.framework/XCTest
Referenced from: /var/containers/Bundle/Application/4492CC47-E278-4D20-93DD-B9FF170479C8/WebDriverAgentRunner-Runner.app/XCTRunner
Reason: no suitable image found. Did find:
另外,这个路径我也打不开啊
/var/containers/
这两个我倒是能找到,这个 bundle 到底有什么用啊?
state->old_bundle: /var/folders/f3/fsxd3f315vg22yc0997bxrl00000gp/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/b52998ac4571334a6ce75968a8a691a2/e01d730b625c83ad877fb699701bc35ea3e800ec/WebDriverAgentRunner-Runner.app
state->new_bundle: /Users/xiaoxue/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app
在进行下面操作的时候一直报错。
OSX:10.12.3
Xcode:8.2.1
iPhone:10.0.2
试过把 appium-server 从 1.6.3 更新到 1.6.4@beta,问题依旧存在。
在 appium-desktop 1.0.0@beta3 上也是。
@codeskyblue,请问有什么解决办法?
谢谢!
# 运行测试
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination "$UDID" test
log 如下:
=== BUILD TARGET WebDriverAgentRunner OF PROJECT WebDriverAgent WITH CONFIGURATION Debug ===
Check dependencies
MDMCreateDeltaDirectory:1920 calling MDMDirectoryDiff with:
state->old_bundle: /var/folders/f3/fsxd3f315vg22yc0997bxrl00000gp/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/b52998ac4571334a6ce75968a8a691a2/e01d730b625c83ad877fb699701bc35ea3e800ec/WebDriverAgentRunner-Runner.app
state->new_bundle: /Users/xiaoxue/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app
state->dst_bundle: /var/folders/f3/fsxd3f315vg22yc0997bxrl00000gp/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.NVj5Yt/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.NVj5Yt/WebDriverAgentRunner-Runner.app_sparse.ipa
__MDMDirectoryDiff_block_invoke.37:1473 calling writeDictToFile with: /var/folders/f3/fsxd3f315vg22yc0997bxrl00000gp/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.NVj5Yt/WebDriverAgentRunner-Runner.app_sparse.ipa/ManifestCache.plist
writeDictToFile:1278 ==== Successfully wrote Manifest cache to /var/folders/f3/fsxd3f315vg22yc0997bxrl00000gp/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.NVj5Yt/WebDriverAgentRunner-Runner.app_sparse.ipa/ManifestCache.plist
dyld: Library not loaded: @rpath/XCTest.framework/XCTest
Referenced from: /var/containers/Bundle/Application/4492CC47-E278-4D20-93DD-B9FF170479C8/WebDriverAgentRunner-Runner.app/XCTRunner
Reason: no suitable image found. Did find:
/private/var/containers/Bundle/Application/4492CC47-E278-4D20-93DD-B9FF170479C8/WebDriverAgentRunner-Runner.app/Frameworks/XCTest.framework/XCTest: code signing blocked mmap() of '/private/var/containers/Bundle/Application/4492CC47-E278-4D20-93DD-B9FF170479C8/WebDriverAgentRunner-Runner.app/Frameworks/XCTest.framework/XCTest'
/private/var/containers/Bundle/Application/4492CC47-E278-4D20-93DD-B9FF170479C8/WebDriverAgentRunner-Runner.app/Frameworks/XCTest.framework/XCTest: code signing blocked mmap() of '/private/var/containers/Bundle/Application/4492CC47-E278-4D20-93DD-B9FF170479C8/WebDriverAgentRunner-Runner.app/Frameworks/XCTest.framework/XCTest'
2017-03-15 11:18:27.561 xcodebuild[1602:8414] 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}
Testing failed:
Test target WebDriverAgentRunner encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted)
** TEST FAILED **