iOS 测试 IOS 真机自动化,这个问题您可曾遇到?!

hello · 2018年06月25日 · 最后由 hello 回复于 2018年06月28日 · 1949 次阅读

iPhone6 Plus IOS 版本:ios 9.3.4
Xcode 版本:Version 8.3.3 (8E3004b)

模拟器是可以运行脚本没有问题。

但是真机在执行下面这句话时
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=dd6a7a9c95d878754537dc31f87445445457fb9a3da' test

shell 终端一直停暂停的感觉,无法执行完成:

MDMCreateDeltaDirectory:1920 calling MDMDirectoryDiff with:
state->old_bundle: /var/folders/td/19m2z20s5j5c8926k5y3ntgw0000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/89d5a96207484b01ee2b03a59bfba602/dd6a7a9c95d5867137dc31f6bd84f8457fb9a3da/WebDriverAgentRunner-Runner.app
state->new_bundle: /Users/joyu_dev/Library/Developer/Xcode/DerivedData/WebDriverAgent-ftyhpdpgltapowgrsrohssojcmla/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app
state->dst_bundle: /var/folders/td/19m2z20s5j5c8926k5y3ntgw0000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.g28xlZ/WebDriverAgentRunner-Runner.app_sparse.ipa/Payload//WebDriverAgentRunner-Runner.app, binaryDiff flag: FALSE
    dst_ipa: /var/folders/td/19m2z20s5j5c8926k5y3ntgw0000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.g28xlZ/WebDriverAgentRunner-Runner.app_sparse.ipa
MDMDirectoryDiff_block_invoke:1473 calling writeDictToFile with: /var/folders/td/19m2z20s5j5c8926k5y3ntgw0000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.g28xlZ/WebDriverAgentRunner-Runner.app_sparse.ipa/ManifestCache.plist
writeDictToFile:1278 ==== Successfully wrote Manifest cache to /var/folders/td/19m2z20s5j5c8926k5y3ntgw0000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.g28xlZ/WebDriverAgentRunner-Runner.app_sparse.ipa/ManifestCache.plist
2018-06-25 14:19:01.370 XCTRunner[1704:695950] Running tests...
2018-06-25 14:19:02.415 XCTRunner[1704:695950] Continuing to run tests in the background with task ID 1
Test Suite 'All tests' started at 2018-06-25 14:19:03.241
Test Suite 'WebDriverAgentRunner.xctest' started at 2018-06-25 14:19:03.244
Test Suite 'UITestingUITests' started at 2018-06-25 14:19:03.244
Test Case '-[UITestingUITests testRunner]' started.
    t =     0.00s     Start Test at 2018-06-25 14:19:03.250
    t =     0.01s     Set Up
2018-06-25 14:19:03.261 XCTRunner[1704:695950] Built at Jun 25 2018 14:18:47
2018-06-25 14:19:03.306 XCTRunner[1704:695950] ServerURLHere->http://10.112.8.80:0<-ServerURLHere

手机里也没弹出” 信任开发者 “弹框,WDA 手机里是已经安装进了的。
麻烦各位老师看一下什么情况。在线等

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

走过路过的给点建议啊。百度都百度不到,只好在这里求助了

@carl 老师,帮忙看看这是怎么辣

hello 回复

这个是什么工具噢?仅仅是装 FACEBOOK 的 WDA 吗?
另外可以试下访问:http://10.112.8.80:0对比下模拟器的时候有什么分别
至于信任框可以在手机设置,通用菜单下面找到,如果这个 APP 有需要信任的话

zzc 回复

多谢,我试试

zzc 回复

老师,昨天看了一下,手机确实被设置了代理,现在把代理关掉了。还是停留在这里,麻烦再帮忙看一下。谢谢了
Test Suite 'All tests' started at 2018-06-26 09:27:08.049
Test Suite 'WebDriverAgentRunner.xctest' started at 2018-06-26 09:27:08.050
Test Suite 'UITestingUITests' started at 2018-06-26 09:27:08.050
Test Case '-[UITestingUITests testRunner]' started.
t = 0.00s Start Test at 2018-06-26 09:27:08.052
t = 0.00s Set Up
2018-06-26 09:27:08.055666 XCTRunner[956:403644] Built at Jun 25 2018 18:58:46
2018-06-26 09:27:08.072043 XCTRunner[956:403644] ServerURLHere->http://192.168.1.113:0<-ServerURLHere

我的 Mac ip :192.168.1.112

我用 xcode 编译后 test 也是你这个现象,但是使用 appium 的时候其实已经可以正常使用了,你可以尝试下

hello #10 · 2018年06月26日 Author
小本淡淡 回复

多谢。我试试去

hello #11 · 2018年06月26日 Author
小本淡淡 回复

FAILED CONFIGURATION: @BeforeTest beforeTest
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not initialize ios-deploy make sure it is installed (npm install -g ios-deploy) and works on your system. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.76 seconds
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z'
System info: host: 'joyu-dev.local', ip: '192.168.1.110', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_40'
Driver info: driver.version: IOSDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)

ios-deploy 这个我是按装过的。这报错是什么情况啊

hello 回复

你是不是 ios-deploy 没有安装成功啊,再安装一遍试试

hello #13 · 2018年06月26日 Author
小本淡淡 回复

** BUILD SUCCEEDED **

/Users/joyu_dev/.npm-global/bin/ios-deploy -> /Users/joyu_dev/.npm-global/lib/node_modules/ios-deploy/build/Release/ios-deploy

  • ios-deploy@1.9.2 updated 1 package in 2.974s

应该是安装成功了

xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=dd6a7a9c95d878754537dc31f87445445457fb9a3da' USE_PORT=8100 test

hello #15 · 2018年06月26日 Author
ziyan 回复

$ xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=9cb7047860c574bde3ff52cs7d8f7s87fsd8s7d8fs784sd48fs' use_port=8100 test

用的就是这个命令

http://192.168.1.113:0 这个端口号不对吧,默认应该是 8100,你用 xcode 打开 WebDriverAgent.xcodeproj 看一下代码,是不是改过了?

hello #17 · 2018年06月28日 Author
隐身 回复

ios-deploy 安装有问题。全部卸载从新安装后可以了

hello 关闭了讨论 06月28日 17:46
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册