Appium 启动 appium 报错:Error launching instruments: Instruments crashed on startup

yefengjun · 2016年12月15日 · 最后由 yefengjun 回复于 2016年12月19日 · 1119 次阅读

我的环境是:
mac:10.12.1
xcode:7.3.1
appium:1.6.3
用脚本启动的 appium 测试 IOS

报错信息如下:

HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"app":"com.JDVideo","platformVersion":"9.0","browserName":"","platformName":"iOS","udid":"65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562","deviceName":"iphone 5s"}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"com.JDVideo","platformVersion":"9.0","browserName":"","platformName":"iOS","udid":"65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562","deviceName":"iphone 5s"},null,null,null,null,null,null,null,null]
[Appium] Creating new IosDriver session
[Appium] Capabilities:
[Appium]   app: 'com.JDVideo'
[Appium]   platformVersion: '9.0'
[Appium]   browserName: ''
[Appium]   platformName: 'iOS'
[Appium]   udid: '65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562'
[Appium]   deviceName: 'iphone 5s'
[debug] [iOS] IosDriver version: 1.13.2
[BaseDriver] Session created with session id: 85813bbf-2414-4633-9078-198f40fbd599
[debug] [iOS] Xcode version set to 7.3.1
[debug] [iOS] Not auto-detecting udid.
[debug] [iOS] App is an iOS bundle, will attempt to run as pre-existing
[debug] [iOS] Removing any remaining instruments sockets
[debug] [iOS] Cleaned up instruments socket /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/instruments_sock
[debug] [iOS] No language specified. Using default strings
[debug] [iOS] Strings file not found. Looking in 'en.lproj' directory
[iOS] Could not file localizable strings file 'Localizable.strings'!
[debug] [iOS] Creating instruments
[debug] [UIAuto] Preparing bootstrap code
[debug] [UIAuto] Dynamic bootstrap dir: /Users/yefengjun/Library/Application Support/appium/bootstrap
[debug] [UIAuto] Dynamic env: {"nodePath":"/usr/local/bin/node","commandProxyClientPath":"/Users/yefengjun/Downloads/appium/node_modules/appium-uiauto/build/lib/bin/command-proxy-client.js","instrumentsSock":"/var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/instruments_sock","interKeyDelay":null,"justLoopInfinitely":false,"autoAcceptAlerts":false,"autoDismissAlerts":false,"sendKeyStrategy":"grouped"}
...bug] [UIAuto] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!
[debug] [UIAuto] Dynamic bootstrap path: /Users/yefengjun/Library/Application Support/appium/bootstrap/bootstrap-b0af3b5801f99608.js
[debug] [UIAuto] Reusing dynamic bootstrap: /Users/yefengjun/Library/Application Support/appium/bootstrap/bootstrap-b0af3b5801f99608.js
[debug] [iOS] Creating iDevice object with udid 65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562
[debug] [iOS] Running ios real device reset flow
[debug] [iOSLog] Attempting iOS device log capture via libimobiledevice idevicesyslog
[debug] [iOSLog] Found idevicesyslog: '/usr/local/bin/idevicesyslog'
[debug] [iOS] App is installed.
[debug] [iOS] fullReset not requested. No need to install.
[debug] [iOS] Starting UIAutoClient, and launching Instruments.
[debug] [UIAuto] Instruments socket server started at /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/instruments_sock
[debug] [Instruments] Instruments is at: /Applications/Xcode7.3.1.app/Contents/Developer/usr/bin/instruments
[debug] [Instruments] Attempting to launch instruments, this is try #1
[Instruments] Launching instruments
[debug] [Instruments] Attempting to run app on real device with UDID '65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562'
[debug] [Instruments] Found Insruments-Without-Delay: /Users/yefengjun/Downloads/appium/node_modules/appium-instruments/thirdparty/iwd7
[debug] [Instruments] Spawning instruments with command: '/Applications/Xcode7.3.1.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode7.3.1.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/appium-instruments/instrumentscli0.trace -w 65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562 com.JDVideo -e UIASCRIPT "/Users/yefengjun/Library/Application Support/appium/bootstrap/bootstrap-b0af3b5801f99608.js" -e UIARESULTSPATH /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/appium-instruments'
[debug] [Instruments] And extra without-delay env: {}
[debug] [Instruments] And launch timeouts (in ms): {"global":90000}
[debug] [Instruments] [INST STDERR] 2016-12-15 19:49:13.193 instruments[15991:1450929] WebKit Threading Violation - initial use of WebKit from a secondary thread.
[debug] [Instruments] Instruments exited with code: 253
[Instruments] Error launching instruments: Instruments crashed on startup
[debug] [Instruments] Attempting to launch instruments, this is try #2
[Instruments] Launching instruments
[debug] [Instruments] Attempting to run app on real device with UDID '65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562'
[debug] [Instruments] Found Insruments-Without-Delay: /Users/yefengjun/Downloads/appium/node_modules/appium-instruments/thirdparty/iwd7
[debug] [Instruments] Spawning instruments with command: '/Applications/Xcode7.3.1.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode7.3.1.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/appium-instruments/instrumentscli0.trace -w 65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562 com.JDVideo -e UIASCRIPT "/Users/yefengjun/Library/Application Support/appium/bootstrap/bootstrap-b0af3b5801f99608.js" -e UIARESULTSPATH /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/appium-instruments'
[debug] [Instruments] And extra without-delay env: {}
[debug] [Instruments] And launch timeouts (in ms): {"global":90000}
[debug] [Instruments] [INST STDERR] 2016-12-15 19:49:19.877 instruments[15998:1451729] WebKit Threading Violation - initial use of WebKit from a secondary thread.
[debug] [Instruments] Instruments exited with code: 253
[Instruments] Error launching instruments: Instruments crashed on startup
[debug] [Instruments] Attempting to launch instruments, this is try #3
[Instruments] Launching instruments
[debug] [Instruments] Attempting to run app on real device with UDID '65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562'
[debug] [Instruments] Found Insruments-Without-Delay: /Users/yefengjun/Downloads/appium/node_modules/appium-instruments/thirdparty/iwd7
[debug] [Instruments] Spawning instruments with command: '/Applications/Xcode7.3.1.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode7.3.1.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/appium-instruments/instrumentscli0.trace -w 65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562 com.JDVideo -e UIASCRIPT "/Users/yefengjun/Library/Application Support/appium/bootstrap/bootstrap-b0af3b5801f99608.js" -e UIARESULTSPATH /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/appium-instruments'
[debug] [Instruments] And extra without-delay env: {}
[debug] [Instruments] And launch timeouts (in ms): {"global":90000}
[debug] [Instruments] [INST STDERR] 2016-12-15 19:49:26.681 instruments[16003:1452405] WebKit Threading Violation - initial use of WebKit from a secondary thread.
[debug] [Instruments] Instruments exited with code: 253
[Instruments] Error launching instruments: Instruments crashed on startup
[debug] [Instruments] Attempting to launch instruments, this is try #4
[Instruments] Launching instruments
[debug] [Instruments] Attempting to run app on real device with UDID '65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562'
[debug] [Instruments] Found Insruments-Without-Delay: /Users/yefengjun/Downloads/appium/node_modules/appium-instruments/thirdparty/iwd7
[debug] [Instruments] Spawning instruments with command: '/Applications/Xcode7.3.1.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode7.3.1.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/appium-instruments/instrumentscli0.trace -w 65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562 com.JDVideo -e UIASCRIPT "/Users/yefengjun/Library/Application Support/appium/bootstrap/bootstrap-b0af3b5801f99608.js" -e UIARESULTSPATH /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/appium-instruments'
[debug] [Instruments] And extra without-delay env: {}
[debug] [Instruments] And launch timeouts (in ms): {"global":90000}
[debug] [Instruments] [INST STDERR] 2016-12-15 19:49:33.270 instruments[16010:1452886] WebKit Threading Violation - initial use of WebKit from a secondary thread.
[debug] [Instruments] Instruments exited with code: 253
[Instruments] Error launching instruments: Instruments crashed on startup
[debug] [Instruments] Attempting to launch instruments, this is try #5
[Instruments] Launching instruments
[debug] [Instruments] Attempting to run app on real device with UDID '65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562'
[debug] [Instruments] Found Insruments-Without-Delay: /Users/yefengjun/Downloads/appium/node_modules/appium-instruments/thirdparty/iwd7
[debug] [Instruments] Spawning instruments with command: '/Applications/Xcode7.3.1.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode7.3.1.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/appium-instruments/instrumentscli0.trace -w 65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562 com.JDVideo -e UIASCRIPT "/Users/yefengjun/Library/Application Support/appium/bootstrap/bootstrap-b0af3b5801f99608.js" -e UIARESULTSPATH /var/folders/m4/ns53sgdd15z_7qf85lwlt_sm0000gn/T/appium-instruments'
[debug] [Instruments] And extra without-delay env: {}
[debug] [Instruments] And launch timeouts (in ms): {"global":90000}
[debug] [Instruments] [INST STDERR] 2016-12-15 19:49:39.950 instruments[16018:1453679] WebKit Threading Violation - initial use of WebKit from a secondary thread.
[debug] [Instruments] Instruments exited with code: 253
[Instruments] Error launching instruments: Instruments crashed on startup
[Instruments] Error: We exceeded the number of retries allowed for instruments to successfully start; failing launch
    at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
    at Instruments.launch$ (../../lib/instruments.js:223:15)
    at tryCatch (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
 Error: We exceeded the number of retries allowed for instruments to successfully start; failing launch
    at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
    at Instruments.launch$ (../../lib/instruments.js:223:15)
    at tryCatch (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[MJSONWP] Encountered internal error running command: Error: We exceeded the number of retries allowed for instruments to successfully start; failing launch
    at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
    at Instruments.launch$ (../../lib/instruments.js:223:15)
    at tryCatch (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Users/yefengjun/Downloads/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[HTTP] <-- POST /wd/hub/session 500 30300 ms - 232 

脚本代码:

DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
        capabilities.setCapability("platformName","IOS");
        capabilities.setCapability("app","com.JDVideo");
        capabilities.setCapability("deviceName","iphone 5s");
        capabilities.setCapability("platformVersion", "9.0");
        capabilities.setCapability("udid","65aa3a56dcd0fcb6b8e4b3dc769bba4baf991562");
        driver =new IOSDriver(new URL("http://0.0.0.0:4723/wd/hub"),capabilities);

各位大神帮忙看一下吧...调试了好几天了一直被这问题困着进行不下去

共收到 4 条回复 时间 点赞
匿名 #1 · 2016年12月19日

这个首先看是否在开发者选项里面是否勾选了 UI Automation

#1 楼 @luguo_ 勾选了,我觉得是我手机没有装签名证书有关。我问开发开发说已经把我这个测试机的 uuid 加到概要文件里了,就不需要再装证书了。目前不知道怎么整了。

匿名 #4 · 2016年12月19日

#2 楼 @yefnegjun 以前的帖子 回复里面有很多检查点你可以尝试下 ,论坛里面还有很多相似问题都可以搜下

https://testerhome.com/topics/1582

常规检查:

1.要有开发者账号

2.设备已经被添加至开发者设备

3.使用 xcode debug 安装应用至手机

4.描述文件中 信任此应用的证书

5.在手机设置 -开发者中 勾选 使用 UI Automation.

#3 楼 @luguo_ 4.描述文件中 信任此应用的证书 我现在是少这个。但是我不知道怎么添加啊?测试的 ipa 我装到手机上也没有让我去信任此应用。描述文件中也没有这个 ipa 的证书可让我去点。我刚刚开始测 ios 没多久。问题有点小白还请见谅....

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册