习惯性伸手党区 模拟器运行 app 出错,求解

云朵 · 2014年09月03日 · 最后由 verainmay 回复于 2015年11月17日 · 1498 次阅读

源码信息

import os
from random import randint
from appium import webdriver
from time import sleep

app = os.path.join(os.path.dirname(__file__),
                       'test-ios/testpackage/build/Release-iphoneos',
                        'XyqMobile.app')
print app
app = os.path.abspath(app)
driver = webdriver.Remote(command_executor='http://127.0.0.1:4723/wd/hub',desired_capabilities={
                'app': app,
                'platformName': 'iOS',
                'platformVersion': '7.0',
                'deviceName': 'iPhone Simulator'
            })
print "--------------test-----------------"
driver.launch_app()

报错信息

info: Attempting to retry launching instruments, this is retry #3
info: Killall iPhoneSimulator
info: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Instruments crashed on startup)","origValue":"Instruments crashed on startup"},"sessionId":null}info: Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate /Users/game-netease/Desktop/test-ios/testpackage/build/Release-iphoneos/XyqMobile.app -e UIASCRIPT /usr/local/lib/node_modules/appium/node_modules/appium-uiauto/uiauto/bootstrap.js -e UIARESULTSPATH /tmp/appium-instruments
info: And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/usr/local/lib/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd/InstrumentsShim.dylib","LIB_PATH":"/usr/local/lib/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd"}
info: And launch timeouts (in ms): {"global":90000}
info: [INST STDERR] posix spawn failure; aborting launch (binary == /Users/game-netease/Desktop/test-ios/testpackage/build/Release-iphoneos/XyqMobile.app/XyqMobile).

info: [INST STDERR] 2014-09-03 15:54:27.917 instruments[1335:707] Recording cancelled : At least one target failed to launch; aborting run
Instruments Trace Error : Error Domain=com.apple.instruments Code=1 "Error Starting Recording" UserInfo=0x7ffc14f016f0 {NSLocalizedDescription=Error Starting Recording, NSLocalizedRecoverySuggestion=At least one target failed to launch; aborting run}
Instruments Trace Error : Failed to start trace.

info: [INSTSERVER] Instruments exited with code 253
info: Killall instruments
error: Instruments crashed on startup
info: Stopping iOS log capture
info: Killing the simulator process
info: Killing any other simulator daemons
info: Cleaning app state.
info: Deleted /Users/game-netease/Library/Application Support/iPhone Simulator/7.0.3/Applications
info: Deleted /Users/game-netease/Library/Application Support/iPhone Simulator/7.0.3/Library/Caches/locationd
info: Deleted /Users/game-netease/Library/Application Support/iPhone Simulator/7.0.3/Library/Keychains
info: Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Instruments crashed on startup
info: Error: Instruments crashed on startup
    at Instruments.onInstrumentsExit (/usr/local/lib/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:398:31)
    at null.<anonymous> (/usr/local/lib/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:328:12)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at Process.ChildProcess._handle.onexit (child_process.js:807:12)
info: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Instruments crashed on startup)","origValue":"Instruments crashed on startup"},"sessionId":null}
共收到 13 条回复 时间 点赞

请说明上下文,并且按照发帖的规定来。否则马上删贴

云朵 #12 · 2014年09月03日 Author

@monkey 不好意思,已改 愿求解...

匿名 #3 · 2014年09月03日

每当我看到 A new session could not be created. 这个报错的时候会习惯性的 stop and launch 一下 appium,然后再试一次。。。o(╯□╰) o

@monkey 用的是 debug 签名 ~

@monkey 需要哪些信息?

系统版本:os x 10.8.5
appium 是最新版本的
appium-doctor ios checks 是没有错的
运行 simple-code 也可以正常运行 ,但是用不是 simple-code 里的 app 就报错了

#4 楼 @yunduo1220 你用 simpole 的 code,那么是 simple 的 app 么?

@monkey code 用的是上面贴的,app 若是用 simple 里的 app(Testapp)是可以的,但是若换成我自己的 app 就不行了 “iOS 模拟器” 未能安装此应用程序。

#6 楼 @yunduo1220 你 app 签名是发布签名还是 debug 签名?

#8 楼 @yunduo1220 从 log 上面看你 instruments 已经启动了,appium 的 session 也有了,你全部关闭,重启跑一遍呢?

云朵 #10 · 2014年09月05日 Author

@monkey 不行的 放大招 重启电脑 也不行....提示 “iOS 模拟器” 未能安装此应用程序。

云朵 #11 · 2014年09月05日 Author

客户端的 Traceback 信息

Traceback (most recent call last):
  File "/Users/game-ns/Desktop/ios_simple.py", line 23, in <module>
    'deviceName': 'iPhone Simulator'
  File "/usr/local/lib/python2.7/site-packages/appium/webdriver/webdriver.py", line 35, in __init__
    super(WebDriver, self).__init__(command_executor, desired_capabilities, browser_profile, proxy, keep_alive)
  File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 73, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 121, in start_session
    'desiredCapabilities': desired_capabilities,
  File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 173, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 164, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: u'A new session could not be created. (Original error: Instruments never checked in)' 

@monkey 是 build 的包不对么 build 指令格式
xcodebuild -sdk iphonesimulator7.0 -configuration Debug -target XyqMobile -arch armv7s

请问这个问题解决了嘛?我也遇到了同样的问题

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