【Appium】Appium 啓動應用日誌分析-iOS

2020-08-11 20:31:11

環境:Mac + Appium 1.18 + xcode11 + iOS13.1
例子:啓動 iOS端 騰訊動漫 APP

Android 啓動流程 對比,iOS簡單好多 ̄△ ̄

1、啓動 Appium server,預設埠4723
2020-08-11 12:05:01:860 - [Appium] Welcome to Appium v1.18.0
2020-08-11 12:05:01:864 - [Appium] Non-default server args:
2020-08-11 12:05:01:865 - [Appium]   logFile: appium.txt
2020-08-11 12:05:01:866 - [Appium]   logTimestamp: true
2020-08-11 12:05:01:894 - [Appium] Appium REST http interface listener started on 0.0.0.0:4723
建立 session,把 desired capabilities 發給 appium server
2020-08-11 12:05:15:024 - [HTTP] --> POST /wd/hub/session
2020-08-11 12:05:15:025 - [HTTP] {"capabilities":{"firstMatch":[{"platformName":"iOS","appium:platformVersion":"13.1.1","appium:deviceName":"my11pro","appium:xcodeOrgId":"kkkkkkkkkkk","appium:xcodeSigningId":"iPhone Developer","appium:automationName":"XCUITest","appium:startIWDP":true,"appium:udid":"auto","appium:bundleId":"com.tencent.ied.app.comic","appium:app":"/Users/xxx/Downloads/8124_1597041068_2.22.0_comic.ipa"}]},"desiredCapabilities":{"platformName":"iOS","platformVersion":"13.1.1","deviceName":"my11pro","xcodeOrgId":"kkkkkkkkkkk","xcodeSigningId":"iPhone Developer","automationName":"XCUITest","startIWDP":true,"udid":"auto","bundleId":"com.tencent.ied.app.comic","app":"/Users/xxx/Downloads/8124_1597041068_2.22.0_comic.ipa"}}
2020-08-11 12:05:15:028 - [debug] [W3C] Calling AppiumDriver.createSession() with args: [{"platformName":"iOS","platformVersion":"13.1.1","deviceName":"my11pro","xcodeOrgId":"kkkkkkkkkkk","xcodeSigningId":"iPhone Developer","automationName":"XCUITest","startIWDP":true,"udid":"auto","bundleId":"com.tencent.ied.app.comic","app":"/Users/xxx/Downloads/8124_1597041068_2.22.0_comic.ipa"},null,{"firstMatch":[{"platformName":"iOS","appium:platformVersion":"13.1.1","appium:deviceName":"my11pro","appium:xcodeOrgId":"kkkkkkkkkkk","appium:xcodeSigningId":"iPhone Developer","appium:automationName":"XCUITest","appium:startIWDP":true,"appium:udid":"auto","appium:bundleId":"com.tencent.ied.app.comic","appium:app":"/Users/xxx/Downloads/8124_1597041068_2.22.0_comic.ipa"}]}]
2020-08-11 12:05:15:029 - [debug] [BaseDriver] Event 'newSessionRequested' logged at 1597147515029 (20:05:15 GMT+0800 (China Standard Time))
2020-08-11 12:05:16:667 - [Appium] Appium v1.18.0 creating new XCUITestDriver (v3.25.0) session
2020-08-11 12:05:16:670 - [debug] [BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided
2020-08-11 12:05:16:670 - [debug] [BaseDriver] Creating session with W3C capabilities: {
2020-08-11 12:05:16:670 - [debug] [BaseDriver]   "alwaysMatch": {
2020-08-11 12:05:16:671 - [debug] [BaseDriver]     "platformName": "iOS",
2020-08-11 12:05:16:671 - [debug] [BaseDriver]     "appium:platformVersion": "13.1.1",
2020-08-11 12:05:16:671 - [debug] [BaseDriver]     "appium:deviceName": "my11pro",
2020-08-11 12:05:16:671 - [debug] [BaseDriver]     "appium:xcodeOrgId": "kkkkkkkkkkk",
2020-08-11 12:05:16:672 - [debug] [BaseDriver]     "appium:xcodeSigningId": "iPhone Developer",
2020-08-11 12:05:16:672 - [debug] [BaseDriver]     "appium:automationName": "XCUITest",
2020-08-11 12:05:16:672 - [debug] [BaseDriver]     "appium:startIWDP": true,
2020-08-11 12:05:16:673 - [debug] [BaseDriver]     "appium:udid": "auto",
2020-08-11 12:05:16:673 - [debug] [BaseDriver]     "appium:bundleId": "com.tencent.ied.app.comic",
2020-08-11 12:05:16:673 - [debug] [BaseDriver]     "appium:app": "/Users/xxx/Downloads/8124_1597041068_2.22.0_comic.ipa"
2020-08-11 12:05:16:673 - [debug] [BaseDriver]   },
2020-08-11 12:05:16:673 - [debug] [BaseDriver]   "firstMatch": [
2020-08-11 12:05:16:673 - [debug] [BaseDriver]     {}
2020-08-11 12:05:16:674 - [debug] [BaseDriver]   ]
2020-08-11 12:05:16:674 - [debug] [BaseDriver] }
2020-08-11 12:05:16:684 - [BaseDriver] Session created with session id: 4da72f8e-1119-42e3-9269-8e1b8fc1906e
把 app 安裝到 真機上
# 獲取裝置 udid,監測爲真機
2020-08-11 12:05:16:729 - [debug] [XCUITest] Current user: 'xxx'
2020-08-11 12:05:16:731 - [debug] [XCUITest] Auto-detecting real device udid...
2020-08-11 12:05:16:765 - [debug] [XCUITest] Detected real device udid: '00008030-001A48322E38802E'
2020-08-11 12:05:16:765 - [debug] [XCUITest] Creating iDevice object with udid '00008030-001A48322E38802E'
2020-08-11 12:05:16:766 - [XCUITest] Determining device to run tests on: udid: '00008030-001A48322E38802E', real device: true
# platformVersion '13.1.1' 改成 '13.1'
2020-08-11 12:05:16:767 - [XCUITest] Normalized platformVersion capability value '13.1.1' to '13.1'
2020-08-11 12:05:16:843 - [debug] [BaseDriver] Event 'xcodeDetailsRetrieved' logged at 1597147516843 (20:05:16 GMT+0800 (China Standard Time))
# ipa測試包 Unzipped 到本地路徑下
2020-08-11 12:05:16:846 - [BaseDriver] Using local app '/Users/xxx/Downloads/8124_1597041068_2.22.0_comic.ipa'
2020-08-11 12:05:17:695 - [debug] [BaseDriver] Unzipping '/Users/xxx/Downloads/8124_1597041068_2.22.0_comic.ipa'
2020-08-11 12:05:17:696 - [debug] [BaseDriver] Enforcing UTF-8 encoding on the extracted file names for '8124_1597041068_2.22.0_comic.ipa'
2020-08-11 12:05:23:303 - [debug] [BaseDriver] Extracted 566 items from '/Users/xxx/Downloads/8124_1597041068_2.22.0_comic.ipa' in 5557ms
2020-08-11 12:05:23:310 - [debug] [BaseDriver] Matched 1 item in the extracted archive. Assuming 'Payload/comic.app' is the correct bundle
2020-08-11 12:05:23:319 - [BaseDriver] Unzipped local app to '/var/folders/75/f7qmzmgj6xlgkb34knzpf3zm0000gn/T/2020711-36064-mrs2br.zjmmh/comic.app'
2020-08-11 12:05:23:320 - [debug] [BaseDriver] Event 'appConfigured' logged at 1597147523320 (20:05:23 GMT+0800 (China Standard Time))
2020-08-11 12:05:23:321 - [debug] [XCUITest] Checking whether app '/var/folders/75/f7qmzmgj6xlgkb34knzpf3zm0000gn/T/2020711-36064-mrs2br.zjmmh/comic.app' is actually present on file system
 
2020-08-11 12:05:23:322 - [debug] [XCUITest] App is present
2020-08-11 12:05:23:322 - [debug] [BaseDriver] Event 'resetStarted' logged at 1597147523322 (20:05:23 GMT+0800 (China Standard Time))
2020-08-11 12:05:23:323 - [debug] [XCUITest] Reset: running ios real device reset flow
2020-08-11 12:05:23:324 - [debug] [BaseDriver] Event 'resetComplete' logged at 1597147523324 (20:05:23 GMT+0800 (China Standard Time))

2020-08-11 12:05:23:326 - [WebDriverAgent] Using WDA path: '/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent'
2020-08-11 12:05:23:327 - [WebDriverAgent] Using WDA agent: '/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj'
2020-08-11 12:05:23:656 - [debug] [XCUITest] Crash reports root '/Users/xxx/Library/Logs/CrashReporter/MobileDevice/my11pro' does not exist. Got nothing to gather.
2020-08-11 12:05:23:657 - [debug] [BaseDriver] Event 'logCaptureStarted' logged at 1597147523657 (20:05:23 GMT+0800 (China Standard Time))
# 解除安裝測試包,重新安裝測試包
2020-08-11 12:05:23:657 - [XCUITest] Setting up real device
2020-08-11 12:05:23:658 - [debug] [XCUITest] Verifying application platform
2020-08-11 12:05:23:663 - [debug] [XCUITest] CFBundleSupportedPlatforms: ["iPhoneOS"]
2020-08-11 12:05:23:939 - [debug] [XCUITest] Reset requested. Removing app with id 'com.tencent.ied.app.comic' from the device
2020-08-11 12:05:24:267 - [debug] [XCUITest] Installing '/var/folders/75/f7qmzmgj6xlgkb34knzpf3zm0000gn/T/2020711-36064-mrs2br.zjmmh/comic.app' on device with UUID '00008030-001A48322E38802E'...
2020-08-11 12:05:29:754 - [debug] [WebDriverAgent] Parsed BUILD_DIR configuration value: '/Users/xxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu/Build/Products'
2020-08-11 12:05:29:757 - [debug] [WebDriverAgent] Got derived data root: '/Users/xxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu'
2020-08-11 12:05:41:001 - [debug] [Support] Traversed 86 directories and 479 files in 16604ms
2020-08-11 12:05:41:005 - [debug] [XCUITest] Pushed the app files successfully after 16736ms
2020-08-11 12:05:41:718 - [XCUITest] App installation succeeded after 17450ms
2020-08-11 12:05:41:719 - [debug] [XCUITest] The app has been installed successfully.
2020-08-11 12:05:41:720 - [debug] [BaseDriver] Event 'appInstalled' logged at 1597147541720 (20:05:41 GMT+0800 (China Standard Time))
WDA初始化
2020-08-11 12:05:41:862 - [debug] [WebDriverAgent] No obsolete cached processes from previous WDA sessions listening on port 8100 have been found
2020-08-11 12:05:41:863 - [DevCon Factory] Requesting connection for device 00008030-001A48322E38802E on local port 8100, device port 8100
2020-08-11 12:05:41:864 - [debug] [DevCon Factory] Cached connections count: 0
2020-08-11 12:05:41:876 - [DevCon Factory] Successfully requested the connection for 00008030-001A48322E38802E:8100
2020-08-11 12:05:41:883 - [debug] [XCUITest] Starting WebDriverAgent initialization with the synchronization key 'XCUITestDriver'

2020-08-11 12:05:41:889 - [debug] [WD Proxy] Matched '/status' to command name 'getStatus'
2020-08-11 12:05:41:893 - [debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
2020-08-11 12:05:41:927 - [debug] [WD Proxy] Got response with status 200: {"value":{"message":"WebDriverAgent is ready to accept commands","state":"success","os":{"testmanagerdVersion":28,"name":"iOS","sdkVersion":"13.0","version":"13.1.1"},"ios":{"ip":"172.16.132.205"},"ready":true,"build":{"time":"Aug 11 2020 18:19:39","productBundleIdentifier":"com.facebook.WebDriverAgentRunner"}},"sessionId":"6ACDECDD-835C-4801-8893-5F1C472B80A6"}

2020-08-11 12:05:41:931 - [debug] [WebDriverAgent] Upgrade timestamp of the currently bundled WDA: 1597140640876
2020-08-11 12:05:41:932 - [debug] [WebDriverAgent] Upgrade timestamp of the WDA on the device: undefined
2020-08-11 12:05:41:932 - [WebDriverAgent] Will reuse previously cached WDA instance at 'http://127.0.0.1:8100/' with 'com.facebook.WebDriverAgentRunner'. Set the wdaLocalPort capability to a value different from 8100 if this is an undesired behavior.
2020-08-11 12:05:41:933 - [debug] [XCUITest] Trying to start WebDriverAgent 1 times with 10000ms interval
2020-08-11 12:05:41:933 - [debug] [XCUITest] These values can be customized by changing wdaStartupRetries/wdaStartupRetryInterval capabilities
2020-08-11 12:05:41:934 - [debug] [BaseDriver] Event 'wdaStartAttempted' logged at 1597147541934 (20:05:41 GMT+0800 (China Standard Time))
2020-08-11 12:05:41:934 - [WebDriverAgent] Using provided WebdriverAgent at 'http://127.0.0.1:8100/'
2020-08-11 12:05:41:936 - [debug] [WD Proxy] Matched '/status' to command name 'getStatus'
2020-08-11 12:05:41:937 - [debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
2020-08-11 12:05:41:953 - [debug] [WD Proxy] Got response with status 200: {"value":{"message":"WebDriverAgent is ready to accept commands","state":"success","os":{"testmanagerdVersion":28,"name":"iOS","sdkVersion":"13.0","version":"13.1.1"},"ios":{"ip":"172.16.132.205"},"ready":true,"build":{"time":"Aug 11 2020 18:19:39","productBundleIdentifier":"com.facebook.WebDriverAgentRunner"}},"sessionId":"6ACDECDD-835C-4801-8893-5F1C472B80A6"}

2020-08-11 12:05:41:954 - [debug] [BaseDriver] Event 'wdaSessionAttempted' logged at 1597147541954 (20:05:41 GMT+0800 (China Standard Time))
2020-08-11 12:05:41:956 - [debug] [XCUITest] Sending createSession command to WDA
2020-08-11 12:05:41:963 - [debug] [WD Proxy] Matched '/session' to command name 'createSession'
2020-08-11 12:05:41:964 - [debug] [WD Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8100/session] with body: {"capabilities":{"firstMatch":[{"bundleId":"com.tencent.ied.app.comic","arguments":[],"environment":{},"eventloopIdleDelaySec":0,"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true}],"alwaysMatch":{}}}
2020-08-11 12:05:43:746 - [debug] [WD Proxy] Got response with status 200: {"value":{"sessionId":"C9EEBA4C-D727-468C-85A5-994D3A0DDE6B","capabilities":{"device":"iphone","browserName":"騰訊漫畫","sdkVersion":"13.1.1","CFBundleIdentifier":"com.tencent.ied.app.comic"}},"sessionId":"C9EEBA4C-D727-468C-85A5-994D3A0DDE6B"}

2020-08-11 12:05:43:746 - [WD Proxy] Determined the downstream protocol as 'W3C'
2020-08-11 12:05:43:747 - [debug] [BaseDriver] Event 'wdaSessionStarted' logged at 1597147543747 (20:05:43 GMT+0800 (China Standard Time))
2020-08-11 12:05:43:747 - [debug] [BaseDriver] Event 'wdaStarted' logged at 1597147543747 (20:05:43 GMT+0800 (China Standard Time))
2020-08-11 12:05:43:748 - [XCUITest] Skipping setting of the initial display orientation. Set the "orientation" capability to either "LANDSCAPE" or "PORTRAIT", if this is an undesired behavior.
2020-08-11 12:05:43:748 - [debug] [BaseDriver] Event 'orientationSet' logged at 1597147543748 (20:05:43 GMT+0800 (China Standard Time))
2020-08-11 12:05:43:749 - [debug] [BaseDriver] The value of 'elementResponseAttributes' setting did not change. Skipping the update for it
2020-08-11 12:05:43:749 - [debug] [BaseDriver] The value of 'shouldUseCompactResponses' setting did not change. Skipping the update for it
2020-08-11 12:05:43:749 - [Appium] New XCUITestDriver session created successfully, session 4da72f8e-1119-42e3-9269-8e1b8fc1906e added to master session list

2020-08-11 12:05:43:750 - [debug] [BaseDriver] Event 'newSessionStarted' logged at 1597147543750 (20:05:43 GMT+0800 (China Standard Time))
2020-08-11 12:05:43:751 - [debug] [W3C (4da72f8e)] Cached the protocol value 'W3C' for the new session 4da72f8e-1119-42e3-9269-8e1b8fc1906e
2020-08-11 12:05:43:752 - [debug] [W3C (4da72f8e)] Responding to client with driver.createSession() result: {"capabilities":{"webStorageEnabled":false,"locationContextEnabled":false,"browserName":"","platform":"MAC","javascriptEnabled":true,"databaseEnabled":false,"takesScreenshot":true,"networkConnectionEnabled":false,"platformName":"iOS","platformVersion":"13.1.1","deviceName":"my11pro","xcodeOrgId":"kkkkkkkkkkk","xcodeSigningId":"iPhone Developer","automationName":"XCUITest","startIWDP":true,"udid":"00008030-001A48322E38802E","bundleId":"com.tencent.ied.app.comic","app":"/Users/xxx/Downloads/8124_1597041068_2.22.0_comic.ipa"}}
隱式等待 35000ms
2020-08-11 12:05:43:765 - [HTTP] --> POST /wd/hub/session/4da72f8e-1119-42e3-9269-8e1b8fc1906e/timeouts
2020-08-11 12:05:43:765 - [HTTP] {"implicit":35000}
2020-08-11 12:05:43:767 - [debug] [W3C (4da72f8e)] Calling AppiumDriver.timeouts() with args: [null,null,null,null,35000,"4da72f8e-1119-42e3-9269-8e1b8fc1906e"]
2020-08-11 12:05:43:768 - [debug] [XCUITest] Executing command 'timeouts'
2020-08-11 12:05:43:769 - [debug] [BaseDriver] W3C timeout argument: {"implicit":35000}}
2020-08-11 12:05:43:769 - [debug] [BaseDriver] Set implicit wait to 35000ms
2020-08-11 12:05:43:770 - [debug] [W3C (4da72f8e)] Responding to client with driver.timeouts() result: null
2020-08-11 12:05:43:771 - [HTTP] <-- POST /wd/hub/session/4da72f8e-1119-42e3-9269-8e1b8fc1906e/timeouts 200 6 ms - 14
查詢元素
2020-08-11 12:05:43:785 - [HTTP] --> POST /wd/hub/session/4da72f8e-1119-42e3-9269-8e1b8fc1906e/element
2020-08-11 12:05:43:785 - [HTTP] {"using":"xpath","value":"//XCUIElementTypeButton[@name='好的']"}
2020-08-11 12:05:43:787 - [debug] [W3C (4da72f8e)] Calling AppiumDriver.findElement() with args: ["xpath","//XCUIElementTypeButton[@name='好的']","4da72f8e-1119-42e3-9269-8e1b8fc1906e"]
2020-08-11 12:05:43:787 - [debug] [XCUITest] Executing command 'findElement'
2020-08-11 12:05:43:788 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
2020-08-11 12:05:43:789 - [debug] [BaseDriver] Waiting up to 35000 ms for condition
2020-08-11 12:05:43:791 - [debug] [WD Proxy] Matched '/element' to command name 'findElement'
2020-08-11 12:05:43:792 - [debug] [WD Proxy] Proxying [POST /element] to [POST http://127.0.0.1:8100/session/C9EEBA4C-D727-468C-85A5-994D3A0DDE6B/element] with body: {"using":"xpath","value":"//XCUIElementTypeButton[@name='好的']"}
2020-08-11 12:05:44:046 - [debug] [WD Proxy] Got response with status 200: {"value":{"ELEMENT":"11000000-0000-0000-DC03-000000000000","element-6066-11e4-a52e-4f735466cecf":"11000000-0000-0000-DC03-000000000000"},"sessionId":"C9EEBA4C-D727-468C-85A5-994D3A0DDE6B"}
2020-08-11 12:05:44:047 - [debug] [W3C (4da72f8e)] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"11000000-0000-0000-DC03-000000000000","ELEMENT":"11000000-0000-0000-DC03-000000000000"}
2020-08-11 12:05:44:048 - [HTTP] <-- POST /wd/hub/session/4da72f8e-1119-42e3-9269-8e1b8fc1906e/element 200 263 ms - 137
對元素進行點選
2020-08-11 12:05:44:051 - [HTTP] --> POST /wd/hub/session/4da72f8e-1119-42e3-9269-8e1b8fc1906e/element/11000000-0000-0000-DC03-000000000000/click
2020-08-11 12:05:44:051 - [HTTP] {"id":"11000000-0000-0000-DC03-000000000000"}
2020-08-11 12:05:44:052 - [W3C (4da72f8e)] Driver proxy active, passing request on via HTTP proxy
2020-08-11 12:05:44:053 - [debug] [XCUITest] Executing command 'proxyReqRes'
2020-08-11 12:05:44:055 - [debug] [WD Proxy] Matched '/wd/hub/session/4da72f8e-1119-42e3-9269-8e1b8fc1906e/element/11000000-0000-0000-DC03-000000000000/click' to command name 'click'
2020-08-11 12:05:44:056 - [debug] [WD Proxy] Proxying [POST /wd/hub/session/4da72f8e-1119-42e3-9269-8e1b8fc1906e/element/11000000-0000-0000-DC03-000000000000/click] to [POST http://127.0.0.1:8100/session/C9EEBA4C-D727-468C-85A5-994D3A0DDE6B/element/11000000-0000-0000-DC03-000000000000/click] with body: {"id":"11000000-0000-0000-DC03-000000000000"}
2020-08-11 12:05:44:426 - [debug] [WD Proxy] Got response with status 200: {"value":null,"sessionId":"C9EEBA4C-D727-468C-85A5-994D3A0DDE6B"}
2020-08-11 12:05:44:427 - [WD Proxy] Replacing sessionId C9EEBA4C-D727-468C-85A5-994D3A0DDE6B with 4da72f8e-1119-42e3-9269-8e1b8fc1906e
2020-08-11 12:05:44:428 - [HTTP] <-- POST

完成✅