Appium Appium 打开 iOS 真机 app 不停闪退重启

kasijia · 2019年04月19日 · 最后由 AylaAsia-heyeping 回复于 2020年05月11日 · 875 次阅读

现象描述:AppiumDesktop 启动 iOS 真机 app,无限闪退重启,毫无头绪😢

MacOS 版本:10.14.3
Xcode 版本:10.2
Appium 版本:1.12.1
另:WebDriverAgent 设置的是个人证书。


报错日志如下:

The server is running

[Appium] Welcome to Appium v1.12.1
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> GET /wd/hub/sessions
[HTTP] {}
[GENERIC] Calling AppiumDriver.getSessions() with args: []
[GENERIC] Responding to client with driver.getSessions() result: []
[HTTP] <-- GET /wd/hub/sessions 200 5 ms - 40
[HTTP]
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"app":"com.netease.cloudmusic","automationName":"XCUITest","deviceName":"iPhone","platformName":"iOS","platformVersion":"12.1.2","udid":"xxxxxxxxxxxxxxxxxxxxxxx","newCommandTimeout":0,"connectHardwareKeyboard":true}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"com.netease.cloudmusic","automationName":"XCUITest","deviceName":"iPhone","platformName":"iOS","platformVersion":"12.1.2","udid":"xxxxxxxxxxxxxxxxxxxxxxx","newCommandTimeout":0,"connectHardwareKeyboard":true},null,null]
[BaseDriver] Event 'newSessionRequested' logged at 1555660576161 (15:56:16 GMT+0800 (CST))
[Appium] Appium v1.12.1 creating new XCUITestDriver (v2.110.1) session
[Appium] Capabilities:
[Appium] app: com.netease.cloudmusic
[Appium] automationName: XCUITest
[Appium] deviceName: iPhone
[Appium] platformName: iOS
[Appium] platformVersion: 12.1.2
[Appium] udid: xxxxxxxxxxxxxxxxxxxxxxx
[Appium] newCommandTimeout: 0
[Appium] connectHardwareKeyboard: true
[BaseDriver] Creating session with MJSONWP desired capabilities: {"app":"com.netease.cloudmu...
[BaseDriver] Session created with session id: 90c3e8a2-9cff-473b-b28a-5d30c7827f52
[XCUITest] Current user: 'boyue'
[XCUITest] Available devices: xxxxxxxxxxxxxxxxxxxxxxx
[XCUITest] Creating iDevice object with udid 'xxxxxxxxxxxxxxxxxxxxxxx'
[XCUITest] Determining device to run tests on: udid: 'xxxxxxxxxxxxxxxxxxxxxxx', real device: true
[XCUITest] Xcode version set to '10.2' (tools v10.2.0.0.1.1552586384)
[XCUITest] iOS SDK Version set to '12.2'
[BaseDriver] Event 'xcodeDetailsRetrieved' logged at 1555660576768 (15:56:16 GMT+0800 (CST))
[XCUITest] App is an iOS bundle, will attempt to run as pre-existing
[BaseDriver] Event 'appConfigured' logged at 1555660576769 (15:56:16 GMT+0800 (CST))
[BaseDriver] Event 'resetStarted' logged at 1555660576769 (15:56:16 GMT+0800 (CST))
[XCUITest] Reset: running ios real device reset flow
[BaseDriver] Event 'resetComplete' logged at 1555660576770 (15:56:16 GMT+0800 (CST))
[iOSLog] Attempting iOS device log capture via libimobiledevice idevicesyslog
[iOSLog] Starting iOS device log capture with: 'idevicesyslog'
[XCUITest] Crash reports root '/Users/boyue/Library/Logs/CrashReporter/MobileDevice/胡雷廷的 iPhone' does not exist. Got nothing to gather.
[BaseDriver] Event 'logCaptureStarted' logged at 1555660576972 (15:56:16 GMT+0800 (CST))
[XCUITest] Setting up real device
[XCUITest] Using WDA path: '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent'
[XCUITest] Using WDA agent: '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj'
[XCUITest] No obsolete cached processes from previous WDA sessions listening on port 8100 have been found
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[WD Proxy] Got response with status 200: "{\n \"value\" : {\n \"state\" : \"success\",\n \"os\" : {\n \"name\" : \"iOS\",\n \"version\" : \"12.1.2\"\n },\n \"ios\" : {\n \"simulatorVersion\" : \"12.1.2\",\n \"ip\" : \"192.168.202.11\"\n },\n \"build\" : {\n \"time\" : \"Apr 19 2019 15:54:41\"\n }\n },\n \"sessionId\" : \"C1877AE7-3043-40BD-82D3-9E64B56989A1\",\n \"status\" : 0\n}"
[XCUITest] Upgrade timestamp of the currently bundled WDA: 1555471056715
[XCUITest] Upgrade timestamp of the WDA on the device: undefined
[XCUITest] Will reuse previously cached WDA instance at 'http://localhost:8100/'. Set the wdaLocalPort capability to a value different from 8100 if this is an undesired behavior.
[XCUITest] Trying to start WebDriverAgent 1 times with 10000ms interval
[XCUITest] These values can be customized by changing wdaStartupRetries/wdaStartupRetryInterval capabilities
[BaseDriver] Event 'wdaStartAttempted' logged at 1555660577503 (15:56:17 GMT+0800 (CST))
[XCUITest] Using provided WebdriverAgent at 'http://localhost:8100/'
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[WD Proxy] Got response with status 200: "{\n \"value\" : {\n \"state\" : \"success\",\n \"os\" : {\n \"name\" : \"iOS\",\n \"version\" : \"12.1.2\"\n },\n \"ios\" : {\n \"simulatorVersion\" : \"12.1.2\",\n \"ip\" : \"192.168.202.11\"\n },\n \"build\" : {\n \"time\" : \"Apr 19 2019 15:54:41\"\n }\n },\n \"sessionId\" : \"C1877AE7-3043-40BD-82D3-9E64B56989A1\",\n \"status\" : 0\n}"
[BaseDriver] Event 'wdaSessionAttempted' logged at 1555660577512 (15:56:17 GMT+0800 (CST))
[XCUITest] Sending createSession command to WDA
[WD Proxy] Matched '/session' to command name 'createSession'
[WD Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {"desiredCapabilities":{"bundleId":"com.netease.cloudmusic","arguments":[],"environment":{},"eventloopIdleDelaySec":0,"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true}}
[WD Proxy] Got response with status 200: {"value":"+[XCAXClient_iOS sharedClient]: unrecognized selector sent to class 0x100f58130\n\n(\n\t0 CoreFoundation 0x0000000212788edc + 252\n\t1 libobjc.A.dylib 0x0000000211959a40 objc_exception_throw + 56\n\t2 CoreFoundation 0x00000002126a6ccc + 0\n\t3 CoreFoundation 0x000000021278e7dc + 1412\n\t4 CoreFoundation 0x000000021279048c _CF_forwarding_prep_0 + 92\n\t5 WebDriverAgentLib 0x0000000104ac429c __37+[FBApplication fb_activeApplication]_block_invoke + 52\n\t6 WebDriverAgentLib 0x0000000104a9d3cc -[FBRunLoopSpinner spinUntilTrue:error:] + 152\n\t7 WebDriverAgentLib 0x0000000104a9d30c -[FBRunLoopSpinner spinUntilTrue:] + 84\n\t8 WebDriverAgentLib 0x0000000104ac3ffc +[FBApplication fb_activeApplication] + 128\n\t9 WebDriverAgentLib 0x0000000104aafa40 -[FBSession ...
[WD Proxy] Got an unexpected response: {"value":"+[XCAXClient_iOS sharedClient]: unrecognized selector sent to class 0x100f58130\n\n(\n\t0 CoreFoundation 0x0000000212788edc + 252\n\t1 libobjc.A.dylib 0x0000000211959a40 objc_exception_throw + 56\n\t2 CoreFoundation ...
[MJSONWP] Matched JSONWP error code 13 to UnknownError
[XCUITest] Failed to create WDA session (An unknown server-side error occurred while processing the command. Original error: +[XCAXClient_iOS sharedClient]: unrecognized selector sent to class 0x100f58130
[XCUITest]
XCUITest). Retrying...
[BaseDriver] Event 'wdaSessionAttempted' logged at 1555660585870 (15:56:25 GMT+0800 (CST))
[XCUITest] Sending createSession command to WDA
[WD Proxy] Matched '/session' to command name 'createSession'
[WD Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {"desiredCapabilities":{"bundleId":"com.netease.cloudmusic","arguments":[],"environment":{},"eventloopIdleDelaySec":0,"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true}}
[WD Proxy] Got response with status 200: {"value":"+[XCAXClient_iOS sharedClient]: unrecognized selector sent to class 0x100f58130\n\n(\n\t0 CoreFoundation 0x0000000212788edc + 252\n\t1 libobjc.A.dylib 0x0000000211959a40 objc_exception_throw + 56\n\t2 CoreFoundation 0x00000002126a6ccc + 0\n\t3 CoreFoundation 0x000000021278e7dc + 1412\n\t4 CoreFoundation 0x000000021279048c _CF_forwarding_prep_0 + 92\n\t5 WebDriverAgentLib 0x0000000104ac429c __37+[FBApplication fb_activeApplication]_block_invoke + 52\n\t6 WebDriverAgentLib 0x0000000104a9d3cc -[FBRunLoopSpinner spinUntilTrue:error:] + 152\n\t7 WebDriverAgentLib 0x0000000104a9d30c -[FBRunLoopSpinner spinUntilTrue:] + 84\n\t8 WebDriverAgentLib 0x0000000104ac3ffc +[FBApplication fb_activeApplication] + 128\n\t9 WebDriverAgentLib 0x0000000104aafa40 -[FBSession ...
[WD Proxy] Got an unexpected response: {"value":"+[XCAXClient_iOS sharedClient]: unrecognized selector sent to class 0x100f58130\n\n(\n\t0 CoreFoundation 0x0000000212788edc + 252\n\t1 libobjc.A.dylib 0x0000000211959a40 objc_exception_throw + 56\n\t2 CoreFoundation ...
[MJSONWP] Matched JSONWP error code 13 to UnknownError
[XCUITest] Failed to create WDA session (An unknown server-side error occurred while processing the command. Original error: +[XCAXClient_iOS sharedClient]: unrecognized selector sent to class 0x100f58130
[XCUITest]
XCUITest). Retrying...
[BaseDriver] Event 'wdaSessionAttempted' logged at 1555660591700 (15:56:31 GMT+0800 (CST))
[XCUITest] Sending createSession command to WDA
[WD Proxy] Matched '/session' to command name 'createSession'
[WD Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {"desiredCapabilities":{"bundleId":"com.netease.cloudmusic","arguments":[],"environment":{},"eventloopIdleDelaySec":0,"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true}}
[WD Proxy] Got response with status 200: {"value":"+[XCAXClient_iOS sharedClient]: unrecognized selector sent to class 0x100f58130\n\n(\n\t0 CoreFoundation 0x0000000212788edc + 252\n\t1 libobjc.A.dylib 0x0000000211959a40 objc_exception_throw + 56\n\t2 CoreFoundation 0x00000002126a6ccc + 0\n\t3 CoreFoundation 0x000000021278e7dc + 1412\n\t4 CoreFoundation 0x000000021279048c _CF_forwarding_prep_0 + 92\n\t5 WebDriverAgentLib 0x0000000104ac429c __37+[FBApplication fb_activeApplication]_block_invoke + 52\n\t6 WebDriverAgentLib 0x0000000104a9d3cc -[FBRunLoopSpinner spinUntilTrue:error:] + 152\n\t7 WebDriverAgentLib 0x0000000104a9d30c -[FBRunLoopSpinner spinUntilTrue:] + 84\n\t8 WebDriverAgentLib 0x0000000104ac3ffc +[FBApplication fb_activeApplication] + 128\n\t9 WebDriverAgentLib 0x0000000104aafa40 -[FBSession ...
[WD Proxy] Got an unexpected response: {"value":"+[XCAXClient_iOS sharedClient]: unrecognized selector sent to class 0x100f58130\n\n(\n\t0 CoreFoundation 0x0000000212788edc + 252\n\t1 libobjc.A.dylib 0x0000000211959a40 objc_exception_throw + 56\n\t2 CoreFoundation ...
[MJSONWP] Matched JSONWP error code 13 to UnknownError
[XCUITest] Failed to create WDA session (An unknown server-side error occurred while processing the command. Original error: +[XCAXClient_iOS sharedClient]: unrecognized selector sent to class 0x100f58130
[XCUITest]
XCUITest). Retrying...
[BaseDriver] Event 'wdaSessionAttempted' logged at 1555660597614 (15:56:37 GMT+0800 (CST))
[XCUITest] Sending createSession command to WDA
[WD Proxy] Matched '/session' to command name 'createSession'
[WD Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {"desiredCapabilities":{"bundleId":"com.netease.cloudmusic","arguments":[],"environment":{},"eventloopIdleDelaySec":0,"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true}}
[WD Proxy] Got response with status 200: {"value":"+[XCAXClient_iOS sharedClient]: unrecognized selector sent to class 0x100f58130\n\n(\n\t0 CoreFoundation 0x0000000212788edc + 252\n\t1 libobjc.A.dylib 0x0000000211959a40 objc_exception_throw + 56\n\t2 CoreFoundation 0x00000002126a6ccc + 0\n\t3 CoreFoundation 0x000000021278e7dc + 1412\n\t4 CoreFoundation 0x000000021279048c _CF_forwarding_prep_0 + 92\n\t5 WebDriverAgentLib 0x0000000104ac429c __37+[FBApplication fb_activeApplication]_block_invoke + 52\n\t6 WebDriverAgentLib 0x0000000104a9d3cc -[FBRunLoopSpinner spinUntilTrue:error:] + 152\n\t7 WebDriverAgentLib 0x0000000104a9d30c -[FBRunLoopSpinner spinUntilTrue:] + 84\n\t8 WebDriverAgentLib 0x0000000104ac3ffc +[FBApplication fb_activeApplication] + 128\n\t9 WebDriverAgentLib 0x0000000104aafa40 -[FBSession ...
[WD Proxy] Got an unexpected response: {"value":"+[XCAXClient_iOS sharedClient]: unrecognized selector sent to class 0x100f58130\n\n(\n\t0 CoreFoundation 0x0000000212788edc + 252\n\t1 libobjc.A.dylib 0x0000000211959a40 objc_exception_throw + 56\n\t2 CoreFoundation ...
[MJSONWP] Matched JSONWP error code 13 to UnknownError
[XCUITest] Failed to create WDA session (An unknown server-side error occurred while processing the command. Original error: +[XCAXClient_iOS sharedClient]: unrecognized selector sent to class 0x100f58130
[XCUITest]
XCUITest). Retrying...
[BaseDriver] Event 'wdaSessionAttempted' logged at 1555660603479 (15:56:43 GMT+0800 (CST))
[XCUITest] Sending createSession command to WDA
[WD Proxy] Matched '/session' to command name 'createSession'
[WD Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {"desiredCapabilities":{"bundleId":"com.netease.cloudmusic","arguments":[],"environment":{},"eventloopIdleDelaySec":0,"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true}}

共收到 9 条回复 时间 点赞
kasijia 关闭了讨论 04月19日 16:46
kasijia 重新开启了讨论 04月19日 16:56
kasijia 关闭了讨论 04月22日 17:23
kasijia 重新开启了讨论 04月22日 17:23

已解决。参考了https://github.com/appium/appium/issues/12462
其实具体原因还没搞清楚,成本有点高所以暂时放弃,先将就着用起来。应该与版本兼容有关,从 github 上下载了最新版本的 WebDriverAgent 重新配置后就可以正常连接 iOS 了。

请问是必须用付费的账号吗

wongminhua 回复

不需要付费账号,我用的是免费个人账号。问题的原因在于我用的是 Facebook 的 WebDriverAgent,换成 Appium 的后就正常运行了。

kasijia 回复

换成 appium 的是怎么样?能具体说一下吗

kasijia 回复

能问下 是怎么替换的吗

12楼 已删除
kasijia 回复

我下载了最新版本 appium 的 WDA,还是会报错
An unknown server-side error occurred while processing the command. Original error: Unable to start WebDriverAgent session because of xcodebuild failure: A new session could not be created. Details: 'capabilities' is mandatory to create a new session Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.

MLL 回复

请问有解决吗?我也遇到这个问题

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