Appium 时常出现{"sessionId":null,"status":6,"value":""}问题

chengaomin · 2015年03月23日 · 最后由 陈恒捷 回复于 2015年03月26日 · 2365 次阅读

我在用 appium 做自动化时候
时常会出现{"sessionId":null,"status":6,"value":""} 的问题
WebDriverException: Message: {"sessionId":null,"status":6,"value":""}
WebDriverException: Message: Instruments died while responding to command, please check appium logs
对自动化影响很大,不知道是什么原因
appium 1.3.6
xcode 6.1.1
iphone6 ios8.1.1

共收到 13 条回复 时间 点赞

instruments 挂了。

#1 楼 @lihuazhang 为啥会挂呢????时常这样啊,受不鸟

能提供详细点的上下文不?例如你脚本大部分情况下执行到哪里会出现这个问题,appium 上对应的详细 log 是什么?
只有 client 端的 exception 信息量太少了。

我也是新手,我也遇到过这个问题。
我出现这个问题的原因是,driver 被我关了两次,所以在第二次关闭时,就报错了这个错误。

我这个是时常出现的,没有特定的场景出现,出现的地方都是不定的,出现之后,再重新跑,就可能好了。。。。。所以很愁,不知道哪里不对。iphone5s 表示这个情况出现的比 iphone6 要少一些

#5 楼 @chengaomin 不够健壮么?

你们说,这个问题是 appium 的问题??还是 app 自身的问题??

贴一段出现这个问题是的 appium log

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.3.6","revision":"004f52f249d3513809e7d0734d9205d1fec19f8e"},"isShuttingDown":false},"sessionId":"7eae8267-552c-49cf-819b-a613cbdbb98e"}
info: <-- GET /wd/hub/status 200 1.039 ms - 178 {"status":0,"value":{"build":{"version":"1.3.6","revision":"004f52f249d3513809e7d0734d9205d1fec19f8e"},"isShuttingDown":false},"sessionId":"7eae8267-552c-49cf-819b-a613cbdbb98e"}

info: [IOS_SYSLOG_ROW ] Mar 26 11:50:53 A050002673-iPhone6 mediaserverd[1931] : 'FigPlayer - 116' (pid = 116) setting DiscoveryMode = DiscoveryMode_None, currentDiscoveryMode = DiscoveryMode_PresenceScan

info: [IOS_SYSLOG_ROW ] Mar 26 11:50:53 A050002673-iPhone6 mediaserverd[1931] : 2015-03-26 11:50:53.897410 AM [AirPlay] BTLE client stopping to browse for AirPlay Solo Target Presence.
info: [IOS_SYSLOG_ROW ] Mar 26 11:50:53 A050002673-iPhone6 mediaserverd[1931] : 2015-03-26 11:50:53.897830 AM [AirPlay] BTLE discovery stopped

info: [IOS_SYSLOG_ROW ] Mar 26 11:50:53 A050002673-iPhone6 wirelessproxd[186] : (Error) trying to stop a scan while the central isn't available

info: [debug] [INST] 2015-03-26 03:50:54 +0000 Debug: Got new command 42 from instruments: au.getElementsByName('取消')

info: [debug] [INST] 2015-03-26 03:50:54 +0000 Debug: evaluating au.getElementsByName('取消')

info: [debug] [INST] 2015-03-26 03:50:55 +0000 Debug: evaluation finished

info: [debug] [INST] 2015-03-26 03:50:55 +0000 Debug: Lookup returned [object UIAButton] with the name "取消" (id: 18).

info: [debug] [INST] 2015-03-26 03:50:55 +0000 Debug: responding with:

info: [debug] [INST] 2015-03-26 03:50:55 +0000 Debug: Running system command #43: /Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":[{"ELEMENT":"18"}]}...

info: [debug] Socket data received (41 bytes)

info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":[{"ELEMENT":"18"}]}
info: [debug] Responding to client with success: {"status":0,"value":[{"ELEMENT":"18"}],"sessionId":"7eae8267-552c-49cf-819b-a613cbdbb98e"}
info: <-- POST /wd/hub/session/7eae8267-552c-49cf-819b-a613cbdbb98e/elements 200 1625.583 ms - 90 {"status":0,"value":[{"ELEMENT":"18"}],"sessionId":"7eae8267-552c-49cf-819b-a613cbdbb98e"}

info: --> POST /wd/hub/session/7eae8267-552c-49cf-819b-a613cbdbb98e/elements {"using":"name","sessionId":"7eae8267-552c-49cf-819b-a613cbdbb98e","value":"取消"}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: "au.getElementsByName('取消')"
info: [debug] Sending command to instruments: au.getElementsByName('取消')

info: [IOS_SYSLOG_ROW ] Mar 26 11:50:55 A050002673-iPhone6 ReportCrash[2216] : MS:Notice: Injecting: (null) ReportCrash

info: [IOS_SYSLOG_ROW ] Mar 26 11:50:55 A050002673-iPhone6 ReportCrash[2216] : task_set_exception_ports(B07, 400, F03, 0, 0) failed with error (4: (os/kern) invalid argument)
info: [IOS_SYSLOG_ROW ] Mar 26 11:50:55 A050002673-iPhone6 ReportCrash[2216] : ReportCrash acting against PID 2205

info: [IOS_SYSLOG_ROW ] Mar 26 11:50:55 A050002673-iPhone6 diagnosticd[705] : error evaluating process info - pid: 2205, punique: 2205

info: [IOS_SYSLOG_ROW ] Mar 26 11:50:55 A050002673-iPhone6 ReportCrash[2216] : Formulating crash report for process ScriptAgent[2205]

info: [IOS_SYSLOG_ROW ] Mar 26 11:50:55 A050002673-iPhone6 backboardd[74] : ALS: SetDisplayFactor: factor=1.0000

info: [debug] [INST STDERR] 2015-03-26 11:50:53.978 instruments[37140:6307] Automation Instrument ran into an exception while trying to run the script. UIAScriptAgentSignaledException
info: [IOS_SYSLOG_ROW ] Mar 26 11:50:55 A050002673-iPhone6 ReportCrash[2216] : Saved report to /var/mobile/Library/Logs/CrashReporter/ScriptAgent_2015-03-26-115055_A050002673-iPhone6.ips

info: [debug] [INST] 2015-03-26 03:50:53 +0000 Fail: An error occurred while trying to run the script.

info: [IOS_SYSLOG_ROW ] Mar 26 11:50:55 A050002673-iPhone6 locationd[111] : Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0

info: [IOS_SYSLOG_ROW ] Mar 26 11:50:55 A050002673-iPhone6 SpringBoard[48] : Unable to get short BSD proc info for 2204: No such process
info: [IOS_SYSLOG_ROW ] Mar 26 11:50:55 A050002673-iPhone6 mediaserverd[1931] : '' com.tudou.tudouiphone(pid = 2204) setting DiscoveryMode = DiscoveryMode_None, currentDiscoveryMode = DiscoveryMode_None
info: [IOS_SYSLOG_ROW ] Mar 26 11:50:55 A050002673-iPhone6 mediaserverd[1931] : '' com.tudou.tudouiphone(pid = 2204) setting DiscoveryMode = DiscoveryMode_None, currentDiscoveryMode = DiscoveryMode_None

info: [IOS_SYSLOG_ROW ] Mar 26 11:50:55 A050002673-iPhone6 SpringBoard[48] : [MPUSystemMediaControls] Updating supported commands for now playing application.
info: [IOS_SYSLOG_ROW ] Mar 26 11:50:55 A050002673-iPhone6 SpringBoard[48] : [MPUSystemMediaControls] Updating supported commands for now playing application.

info: [IOS_SYSLOG_ROW ] Mar 26 11:50:55 A050002673-iPhone6 com.apple.xpc.launchd1 : Service exited due to signal: Killed: 9
info: [IOS_SYSLOG_ROW ] Mar 26 11:50:55 A050002673-iPhone6 mediaserverd[1931] : 'FigPlayer - 116' (pid = 116) setting DiscoveryMode = DiscoveryMode_None, currentDiscoveryMode = DiscoveryMode_None

info: [debug] [INST] Instruments Trace Complete (Duration : 96.331673s; Output : /tmp/appium-instruments/instrumentscli0.trace)

info: [debug] [INSTSERVER] Instruments exited with code 0
info: [debug] Cleaning up after instruments exit
info: [debug] Instruments exited unexpectedly
info: [debug] Shutting down command proxy and ignoring any errors
info: [debug] Closing socket server.
info: [debug] Instruments socket server was closed
info: [debug] Stopping iOS log capture
info: [debug] Running ios sim reset flow
info: [debug] Killing the simulator process
info: [debug] Killall iOS Simulator
info: [debug] Killing any other simulator daemons
info: [IOS_SYSLOG_ROW ] Mar 26 11:50:55 A050002673-iPhone6 DTMobileIS[630] : Could not create service named com.apple.instruments.server.services.processcontrol.posixspawn

info: [debug] On a real device; cannot clean device state

info: [debug] We were in the middle of processing a command when instruments died; responding with a generic error
info: [debug] Cleaning up appium session
info: [debug] Condition unmet after 376ms. Timing out.
info: [debug] Responding to client with error: {"status":13,"value":{"message":"Instruments died while responding to command, please check appium logs","name":"UnknownError","origValue":"Instruments died while responding to command, please check appium logs"},"sessionId":null}
*info: <-- POST /wd/hub/session/7eae8267-552c-49cf-819b-a613cbdbb98e/elements 500 378.844 ms - 230 *

info: --> GET /wd/hub/session/7eae8267-552c-49cf-819b-a613cbdbb98e/screenshot {}
info: <-- GET /wd/hub/session/7eae8267-552c-49cf-819b-a613cbdbb98e/screenshot 404 1.685 ms - 40

info: --> POST /wd/hub/session/7eae8267-552c-49cf-819b-a613cbdbb98e/elements {"using":"xpath","sessionId":"7eae8267-552c-49cf-819b-a613cbdbb98e","value":"//UIAApplication[1]/UIAWindow[2]/UIATableView[1]/UIATableCell[1]"}
info: <-- POST /wd/hub/session/7eae8267-552c-49cf-819b-a613cbdbb98e/elements 404 1.053 ms - 40
info: --> GET /wd/hub/session/7eae8267-552c-49cf-819b-a613cbdbb98e/screenshot {}
info: <-- GET /wd/hub/session/7eae8267-552c-49cf-819b-a613cbdbb98e/screenshot 404 0.618 ms - 40

希望大家能帮帮我,谢谢

从 log 看到是在这个位置开始出错的:

info: [IOS_SYSLOG_ROW ] Mar 26 11:50:55 A050002673-iPhone6 ReportCrash[2216] <Notice>: MS:Notice: Injecting: (null) ReportCrash

info: [IOS_SYSLOG_ROW ] Mar 26 11:50:55 A050002673-iPhone6 ReportCrash[2216] <Error>: task_set_exception_ports(B07, 400, F03, 0, 0) failed with error (4: (os/kern) invalid argument)
info: [IOS_SYSLOG_ROW ] Mar 26 11:50:55 A050002673-iPhone6 ReportCrash[2216] <Notice>: ReportCrash acting against PID 2205

info: [IOS_SYSLOG_ROW ] Mar 26 11:50:55 A050002673-iPhone6 diagnosticd[705] <Error>: error evaluating process info - pid: 2205, punique: 2205

info: [IOS_SYSLOG_ROW ] Mar 26 11:50:55 A050002673-iPhone6 ReportCrash[2216] <Notice>: Formulating crash report for process ScriptAgent[2205]

info: [IOS_SYSLOG_ROW ] Mar 26 11:50:55 A050002673-iPhone6 backboardd[74] <Notice>: ALS: SetDisplayFactor: factor=1.0000

info: [debug] [INST STDERR] 2015-03-26 11:50:53.978 instruments[37140:6307] Automation Instrument ran into an exception while trying to run the script. UIAScriptAgentSignaledException

Automation Instrument ran into an exception while trying to run the script. UIAScriptAgentSignaledException搜索,在 github 找到个类似的 issue:
https://github.com/appium/appium/issues/3687
你是不是没有打开开发者选项的Enable UI Automation?(我不大记得中文叫什么了)?

#11 楼 @chenhengjie123 开了,不开都无法启动 app 的

@chengaomin 在写 case,遇到了同样的问题,你的后来解决了吗?我想循环跑 case,先跑了一个 loop,然后 quit 了,再去启动循环跑时就出现了这个错误。

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