Appium appium 运行 ios 自动化测试时,应用界面加载不出来,日志及截图如下,求大佬指点,多谢~~~~

黑凤梨 · 2020年09月09日 · 最后由 huhu 回复于 2021年12月03日 · 2206 次阅读

版本:
APPIUM 1.15.1
Mac os 10.13.6
Xcode 10.1

[Appium] Welcome to Appium v1.15.1
[Appium] Non-default server args:
[Appium] allowInsecure: {
[Appium] }
[Appium] denyInsecure: {
[Appium] }
[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 8 ms - 40
[HTTP]
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"automationName":"XCUITest","bundleId":"com.yeepay.FlyBird","deviceName":"iPhone 8","newCommandTimeout":"3600","noReset":false,"platformName":"iOS","platformVersion":"13.6.1","udid":"7ce2b559b35dbe803836231ccf6dd5ceb6d10942","connectHardwareKeyboard":true}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"automationName":"XCUITest","bundleId":"com.yeepay.FlyBird","deviceName":"iPhone 8","newCommandTimeout":"3600","noReset":false,"platformName":"iOS","platformVersion":"13.6.1","udid":"7ce2b559b35dbe803836231ccf6dd5ceb6d10942","connectHardwareKeyboard":true},null,null]
[BaseDriver] Event 'newSessionRequested' logged at 1599623380220 (11:49:40 GMT+0800 (CST))
[Appium] Appium v1.15.1 creating new XCUITestDriver (v2.133.1) session
[BaseDriver] Creating session with MJSONWP desired capabilities: {
[BaseDriver] "automationName": "XCUITest",
[BaseDriver] "bundleId": "com.yeepay.FlyBird",
[BaseDriver] "deviceName": "iPhone 8",
[BaseDriver] "newCommandTimeout": "3600",
[BaseDriver] "noReset": false,
[BaseDriver] "platformName": "iOS",
[BaseDriver] "platformVersion": "13.6.1",
[BaseDriver] "udid": "7ce2b559b35dbe803836231ccf6dd5ceb6d10942",
[BaseDriver] "connectHardwareKeyboard": true
[BaseDriver] }
[BaseDriver] Capability 'newCommandTimeout' changed from string ('3600') to integer (3600). This may cause unexpected behavior
[BaseDriver] Session created with session id: d25eed75-268c-4464-b9c5-b0e969efb75a
[XCUITest] Current user: 'yp-tc-2858'
[XCUITest] Available devices: 7ce2b559b35dbe803836231ccf6dd5ceb6d10942
[XCUITest] Creating iDevice object with udid '7ce2b559b35dbe803836231ccf6dd5ceb6d10942'
[XCUITest] Determining device to run tests on: udid: '7ce2b559b35dbe803836231ccf6dd5ceb6d10942', real device: true
[XCUITest] Normalized platformVersion capability value '13.6.1' to '13.6'
[BaseDriver] Event 'xcodeDetailsRetrieved' logged at 1599623386419 (11:49:46 GMT+0800 (CST))
[BaseDriver] Event 'appConfigured' logged at 1599623386420 (11:49:46 GMT+0800 (CST))
[BaseDriver] Event 'resetStarted' logged at 1599623386420 (11:49:46 GMT+0800 (CST))
[XCUITest] Reset: running ios real device reset flow
[BaseDriver] Event 'resetComplete' logged at 1599623386421 (11:49:46 GMT+0800 (CST))
[BaseDriver] Event 'logCaptureStarted' logged at 1599623386825 (11:49:46 GMT+0800 (CST))
[XCUITest] Setting up real device
[XCUITest] Using WDA path: '/Applications/Appium.app/Contents/Resources/app/node_modules/appium-webdriveragent'
[XCUITest] Using WDA agent: '/Applications/Appium.app/Contents/Resources/app/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj'
[XCUITest] No obsolete cached processes from previous WDA sessions listening on port 8100 have been found
[DevCon Factory] Requesting connection for device 7ce2b559b35dbe803836231ccf6dd5ceb6d10942 on local port 8100, device port 8100
[DevCon Factory] Cached connections count: 0
[DevCon Factory] Port #8100 is busy
[DevCon Factory] Successfully requested the connection for 7ce2b559b35dbe803836231ccf6dd5ceb6d10942:8100
[XCUITest] Starting WebDriverAgent initialization with the synchronization key 'XCUITestDriver'
[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: {
[WD Proxy] "value" : {
[WD Proxy] "message" : "WebDriverAgent is ready to accept commands",
[WD Proxy] "state" : "success",
[WD Proxy] "os" : {
[WD Proxy] "testmanagerdVersion" : 28,
[WD Proxy] "name" : "iOS",
[WD Proxy] "sdkVersion" : "12.0",
[WD Proxy] "version" : "13.6.1"
[WD Proxy] },
[WD Proxy] "ios" : {
[WD Proxy] "ip" : "172.18.160.199"
[WD Proxy] },
[WD Proxy] "ready" : true,
[WD Proxy] "build" : {
[WD Proxy] "time" : "Sep 8 2020 14:09:29",
[WD Proxy] "productBundleIdentifier" : "com.facebook.WebDriverAgentRunner"
[WD Proxy] }
[WD Proxy] },
[WD Proxy] "sessionId" : null
[WD Proxy] }
[XCUITest] Upgrade timestamp of the currently bundled WDA: 1599558558487
[XCUITest] Upgrade timestamp of the WDA on the device: undefined
[XCUITest] Will reuse previously cached WDA instance at 'http://localhost:8100/' with 'com.facebook.WebDriverAgentRunner'. 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 1599623387250 (11:49:47 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: {
[WD Proxy] "value" : {
[WD Proxy] "message" : "WebDriverAgent is ready to accept commands",
[WD Proxy] "state" : "success",
[WD Proxy] "os" : {
[WD Proxy] "testmanagerdVersion" : 28,
[WD Proxy] "name" : "iOS",
[WD Proxy] "sdkVersion" : "12.0",
[WD Proxy] "version" : "13.6.1"
[WD Proxy] },
[WD Proxy] "ios" : {
[WD Proxy] "ip" : "172.18.160.199"
[WD Proxy] },
[WD Proxy] "ready" : true,
[WD Proxy] "build" : {
[WD Proxy] "time" : "Sep 8 2020 14:09:29",
[WD Proxy] "productBundleIdentifier" : "com.facebook.WebDriverAgentRunner"
[WD Proxy] }
[WD Proxy] },
[WD Proxy] "sessionId" : null
[WD Proxy] }
[BaseDriver] Event 'wdaSessionAttempted' logged at 1599623387292 (11:49:47 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: {"capabilities":{"firstMatch":[{"bundleId":"com.yeepay.FlyBird","arguments":[],"environment":{},"eventloopIdleDelaySec":0,"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true}],"alwaysMatch":{}}}
[WD Proxy] Got response with status 200: {"value":{"sessionId":"E5FB194B-3F02-44AD-A456-3BFD031C78A3","capabilities":{"device":"iphone","browserName":null,"sdkVersion":"13.6.1","CFBundleIdentifier":null}},"sessionId":"E5FB194B-3F02-44AD-A456-3BFD031C78A3"}
[WD Proxy] Determined the downstream protocol as 'W3C'
[BaseDriver] Event 'wdaSessionStarted' logged at 1599623388809 (11:49:48 GMT+0800 (CST))
[BaseDriver] Event 'wdaStarted' logged at 1599623388810 (11:49:48 GMT+0800 (CST))
[XCUITest] Skipping setting of the initial display orientation. Set the "orientation" capability to either "LANDSCAPE" or "PORTRAIT", if this is an undesired behavior.
[BaseDriver] Event 'orientationSet' logged at 1599623388811 (11:49:48 GMT+0800 (CST))
[Appium] New XCUITestDriver session created successfully, session d25eed75-268c-4464-b9c5-b0e969efb75a added to master session list
[BaseDriver] Event 'newSessionStarted' logged at 1599623388815 (11:49:48 GMT+0800 (CST))
[MJSONWP (d25eed75)] Cached the protocol value 'MJSONWP' for the new session d25eed75-268c-4464-b9c5-b0e969efb75a
[MJSONWP (d25eed75)] Responding to client with driver.createSession() result: {"webStorageEnabled":false,"locationContextEnabled":false,"browserName":"","platform":"MAC","javascriptEnabled":true,"databaseEnabled":false,"takesScreenshot":true,"networkConnectionEnabled":false,"automationName":"XCUITest","bundleId":"com.yeepay.FlyBird","deviceName":"iPhone 8","newCommandTimeout":3600,"noReset":false,"platformName":"iOS","platformVersion":"13.6.1","udid":"7ce2b559b35dbe803836231ccf6dd5ceb6d10942","connectHardwareKeyboard":true}
[HTTP] <-- POST /wd/hub/session 200 8601 ms - 523
[HTTP]
[HTTP] --> POST /wd/hub/session/d25eed75-268c-4464-b9c5-b0e969efb75a/context
[HTTP] {"name":"NATIVE_APP"}
[MJSONWP (d25eed75)] Calling AppiumDriver.setContext() with args: ["NATIVE_APP","d25eed75-268c-4464-b9c5-b0e969efb75a"]
[XCUITest] Executing command 'setContext'
[XCUITest] Attempting to set context to 'NATIVE_APP'
[MJSONWP (d25eed75)] Responding to client with driver.setContext() result: null
[HTTP] <-- POST /wd/hub/session/d25eed75-268c-4464-b9c5-b0e969efb75a/context 200 107 ms - 76
[HTTP]
[HTTP] --> GET /wd/hub/session/d25eed75-268c-4464-b9c5-b0e969efb75a/screenshot
[HTTP] {}
[MJSONWP (d25eed75)] Calling AppiumDriver.getScreenshot() with args: ["d25eed75-268c-4464-b9c5-b0e969efb75a"]
[XCUITest] Executing command 'getScreenshot'
[HTTP] --> GET /wd/hub/session/d25eed75-268c-4464-b9c5-b0e969efb75a/source
[HTTP] {}
[MJSONWP (d25eed75)] Calling AppiumDriver.getPageSource() with args: ["d25eed75-268c-4464-b9c5-b0e969efb75a"]
[XCUITest] Executing command 'getPageSource'
[HTTP] --> GET /wd/hub/session/d25eed75-268c-4464-b9c5-b0e969efb75a/window/current/size
[HTTP] {}
[MJSONWP (d25eed75)] Calling AppiumDriver.getWindowSize() with args: ["current","d25eed75-268c-4464-b9c5-b0e969efb75a"]
[XCUITest] Executing command 'getWindowSize'
[XCUITest] Taking screenshot with WDA
[WD Proxy] Matched '/screenshot' to command name 'getScreenshot'
[WD Proxy] Proxying [GET /screenshot] to [GET http://localhost:8100/session/E5FB194B-3F02-44AD-A456-3BFD031C78A3/screenshot] with no body
[WD Proxy] Got response with status 200: {
[WD Proxy] "value" : "iVBORw0KGgoAAAANSUhEUgAAAu4AAAU2CAIAAABFtaRRAAAAAXNSR0IArs4c6QAA\r\nAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKAC\r\nAAQAAAABAAAC7qADAAQAAAABAAAFNgAAAACw0axrAAAAHGlET1QAAAACAAAAAAAA\r\nApsAAAAoAAACmwAAApsAAWZc0R2aBAAAQABJREFUeAHs3Ye\/b0V1N\/7nH\/jFiihi\r\nSXzSVKpgDZpiARsi9QIiItgVNYIlJiZqTOz6GHvXGE00iRVERUEpCgKXeylKl97v\r\nvaf37+89+3PO3H3K93AOXMqVfV7zmjN7Zs2aNWutWWvt2bP39\/+MDE90qeNAx4GO\r\nAx0HOg50HLiXc2B8aLJJY+NDY6PDJTUMmRwenh4e7pU01BsZ6o0O9kaHpscHp0dG\r\nxqTR4QkpfVMzODoibRyXxjaMT2wYm751XOo1OEEW4JHhkoYbDOPDQ1NDQ71N0sjU\r\n4AhsG8cmdVm5OP7PykE7yI4DHQc6DnQc6DjQceD3lQOjQ5MlldCkiWOaOKOZrLBD\r\nYDGbwDThSIljSgKfjk2AMjwyIUAZHK1pYnBkcnBkenBkNpQJcBPHTA6OFuCRkZHx\r\n4ZHpgZImhgrCjaMl+lk5n7tQptuU6jjQcaDjQMeBjgMdB3BA9CBqmZiNUYQYc3+j\r\nwzZLRkZHhkZHBsZHNo2PbJBEIU3g0gQ6zYbN7OZNgycRz8Tg5NRASdObpkuQ1AQ9\r\nBhLcDIxOC1lswAyUgKYMCmB4xOV0s5HT60KZTik7DnQc6DjQcaDjQMeBVXEgD31K\r\nYGFbZXh0RMpfK5QZGhkdGBndJDWVY6KTEgM1oUzyUQ+hPIEampwYnJgamJieSzWO\r\n8cSqhDIjvRLNlFAm2zNl3DJ02cUplV0osyrhdcAdBzoOdBzoON...
[WD Proxy] Matched '/source' to command name 'getPageSource'
[WD Proxy] Proxying [GET /source] to [GET http://localhost:8100/session/E5FB194B-3F02-44AD-A456-3BFD031C78A3/source] with no body
[MJSONWP (d25eed75)] Responding to client with driver.getScreenshot() result: "iVBORw0KGgoAAAANSUhEUgAAAu4AAAU2CAIAAABFtaRRAAAAAXNSR0IArs4c6QAA\r\nAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKAC\r\nAAQAAAABAAAC7qADAAQAAAABAAAFNgAAAACw0axrAAAAHGlET1QAAAACAAAAAAAA\r\nApsAAAAoAAACmwAAApsAAWZc0R2aBAAAQABJREFUeAHs3Ye/b0V1N/7nH/jFiihi\r\nSXzSVKpgDZpiARsi9QIiItgVNYIlJiZqTOz6GHvXGE00iRVERUEpCgKXeylKl97v\r\nvaf37+89+3PO3H3K93AOXMqVfV7zmjN7Zs2aNWutWWvt2bP39/+MDE90qeNAx4GO\r\nAx0HOg50HLiXc2B8aLJJY+NDY6PDJTUMmRwenh4e7pU01BsZ6o0O9kaHpscHp0dG\r\nxqTR4QkpfVMzODoibRyXxjaMT2wYm751XOo1OEEW4JHhkoYbDOPDQ1NDQ71N0sjU\r\n4AhsG8cmdVm5OP7PykE7yI4DHQc6DnQc6DjQceD3lQOjQ5MlldCkiWOaOKOZrLBD\r\nYDGbwDThSIljSgKfjk2AMjwyIUAZHK1pYnBkcnBkenBkNpQJcBPHTA6OFuCRkZHx\r\n4ZHpgZImhgrCjaMl+lk5n7tQptuU6jjQcaDjQMeBjgMdB3BA9CBqmZiNUYQYc3+j\r\nwzZLRkZHhkZHBsZHNo2PbJBEIU3g0gQ6zYbN7OZNgycRz8Tg5NRASdObpkuQ1AQ9\r\nBhLcDIxOC1lswAyUgKYMCmB4xOV0s5HT60KZTik7DnQc6DjQcaDjQMeBVXEgD31K\r\nYGFbZXh0RMpfK5QZGhkdGBndJDWVY6KTEgM1oUzyUQ+hPIEampwYnJgamJieSzWO\r\n8cSqhDIjvRLNlFAm2zNl3DJ02cUplV0osyrhdcAdBzoOdBzoONBxoONA4UATx0zY\r\n...
[HTTP] <-- GET /wd/hub/session/d25eed75-268c-4464-b9c5-b0e969efb75a/screenshot 200 105 ms - 249934
[HTTP]
[WD Proxy] Got response with status 500: {
[WD Proxy] "value" : {
[WD Proxy] "error" : "unknown error",
[WD Proxy] "message" : "Cannot get 'xml' source of the current application",
[WD Proxy] "traceback" : ""
[WD Proxy] },
[WD Proxy] "sessionId" : "E5FB194B-3F02-44AD-A456-3BFD031C78A3"
[WD Proxy] }
[W3C] Matched W3C error code 'unknown error' to UnknownError
[WD Proxy] Proxying [GET /window/size] to [GET http://localhost:8100/session/E5FB194B-3F02-44AD-A456-3BFD031C78A3/window/size] with no body
[MJSONWP (d25eed75)] Encountered internal error running command: UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot get 'xml' source of the current application
[MJSONWP (d25eed75)] at errorFromW3CJsonCode (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/node_modules/appium-base-driver/lib/protocol/errors.js:780:25)
[MJSONWP (d25eed75)] at ProxyRequestError.errorFromW3CJsonCode as getActualError
[MJSONWP (d25eed75)] at JWProxy.getActualError as command
[HTTP] <-- GET /wd/hub/session/d25eed75-268c-4464-b9c5-b0e969efb75a/source 500 267 ms - 221
[HTTP]
[WD Proxy] Got response with status 200: {
[WD Proxy] "value" : {
[WD Proxy] "width" : 0,
[WD Proxy] "height" : 0
[WD Proxy] },
[WD Proxy] "sessionId" : "E5FB194B-3F02-44AD-A456-3BFD031C78A3"
[WD Proxy] }
[MJSONWP (d25eed75)] Responding to client with driver.getWindowSize() result: {"width":0,"height":0}
[HTTP] <-- GET /wd/hub/session/d25eed75-268c-4464-b9c5-b0e969efb75a/window/current/size 200 331 ms - 94
[HTTP]


{
"platformName": "iOS",
"platformVersion": "13.6.1",
"deviceName": "iPhone 8",
"udid": "7ce2b559b35dbe803836231ccf6dd5ceb6d10942",
"noReset": false,
"bundleId": "com.yeepay.FlyBird",
"automationName": "XCUITest",
"newCommandTimeout": "3600"
}

共收到 5 条回复 时间 点赞

iOS 建议试一下 weditor 这个 Python 库,在浏览器上抓取页面元素挺好的方便的

Jerry li 回复

这个怎么用,方便举例说明下么额...😀

董延京 回复

额,站内或者 github 搜索一下吧

请问你这个问题解决了吗?我现在遇到了同样的问题

我根据 git 上面的教程解决了!!!附上链接https://github.com/appium/appium/issues/15898

1.Upgraded Appium Desktop to Appium Server GUI v1.22.0 and installed Appium Inspector because it is not bundled with Appium Server GUI
2.Used the WebDriverAgent bundled with the new Appium Server GUI > Tested WDA > Trusted WDA from device management on the iPhone
3.Opened Appium Inspector and changed Remote Path to /wd/hub instead of /
4.When you start a new session from Appium Inspector it will now request you to enter your Passcode on the iPhone then display a transparent overlay on the iPhone display that reads Automation Running - Hold both volume buttons to stop which is something new with iOS 15 as KazuCocoa has mentioned (RESIST THE TEMPTATION OF HOLDING BOTH VOLUME BUTTONS)
5.After that, your application should open just fine and load the page source

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