Appium日志的查看

服务器运行中
[Appium] Welcome to Appium v1.15.1 
# 启动appium
[Appium] Non-default server args:
[Appium]   allowInsecure: {
[Appium]   }
[Appium]   denyInsecure: {
[Appium]   }
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
# appium的rest http 接口开始监听 4723 端口;
[HTTP] --> POST /wd/hub/session	
# appium接收到一个post请求 /wd/hub/session,并携带了 capabilities 字典参数;
[HTTP] {"capabilities":{"firstMatch":[{"platformName":"Android","appium:automationName":"UiAutomator2","appium:platformVersion":"7.1.2","appium:deviceName":"HUAWEI","appium:appPackage":"com.lemon.lemonban","appium:appActivity":"com.lemon.lemonban.activity.MainActivity","appium:noReset":"True"}]},"desiredCapabilities":{"platformName":"Android","automationName":"UiAutomator2","platformVersion":"7.1.2","deviceName":"HUAWEI","appPackage":"com.lemon.lemonban","appActivity":"com.lemon.lemonban.activity.MainActivity","noReset":"True"}}
[W3C] Calling AppiumDriver.createSession() with args: 
# appium创建session;
[{"platformName":"Android","automationName":"UiAutomator2","platformVersion":"7.1.2","deviceName":"HUAWEI","appPackage":"com.lemon.lemonban","appActivity":"com.lemon.lemonban.activity.MainActivity","noReset":"True"},null,{"firstMatch":[{"platformName":"Android","appium:automationName":"UiAutomator2","appium:platformVersion":"7.1.2","appium:deviceName":"HUAWEI","appium:appPackage":"com.lemon.lemonban","appium:appActivity":"com.lemon.lemonban.activity.MainActivity","appium:noReset":"True"}]}]
[BaseDriver] Event 'newSessionRequested' logged at 1644924674121 (19:31:14 GMT+0800 (中国标准时间))
[Appium] Could not parse W3C capabilities: 'noReset' must be of type boolean
[Appium] Trying to fix W3C capabilities by merging them with JSONWP caps
[BaseDriver] The capabilities ["automationName","platformVersion","deviceName","appPackage","appActivity","noReset"] are not standard capabilities and should have an extension prefix
[Appium] Could not parse fixed W3C capabilities: 'noReset' must be of type boolean. Falling back to JSONWP protocol
[Appium] Appium v1.15.1 creating new AndroidUiautomator2Driver (v1.37.2) session
[BaseDriver] Creating session with MJSONWP desired capabilities: {
[BaseDriver]   "platformName": "Android",
[BaseDriver]   "automationName": "UiAutomator2",
[BaseDriver]   "platformVersion": "7.1.2",
[BaseDriver]   "deviceName": "HUAWEI",
[BaseDriver]   "appPackage": "com.lemon.lemonban",
[BaseDriver]   "appActivity": "com.lemon.lemonban.activity.MainActivity",
[BaseDriver]   "noReset": "True"
[BaseDriver] }
[BaseDriver] Capability 'noReset' changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Session created with session id: 7e471ba7-ec6a-4e18-b64e-7df671883f27
#调用 AppiumDriver.createSession() 方法,并把携带的参数传入;
#创建成功session,显示session id
[UiAutomator2] Starting 'com.lemon.lemonban' directly on the device
[ADB] Using 'adb.exe' from 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe'
[AndroidDriver] Retrieving device list
[ADB] Trying to find a connected android device
[ADB] Getting connected devices...
[ADB] Connected devices: [{"udid":"127.0.0.1:62001","state":"device"}]
[AndroidDriver] Looking for a device with Android '7.1.2'
# 检查连接设备的信息
[ADB] Setting device id to 127.0.0.1:62001
[ADB] Getting device platform version
[ADB] Running 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell getprop ro.build.version.release'
[ADB] Current device property 'ro.build.version.release': 7.1.2
[AndroidDriver] Using device: 127.0.0.1:62001
[ADB] Using 'adb.exe' from 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe'
[ADB] Setting device id to 127.0.0.1:62001
[ADB] Running 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell getprop ro.build.version.sdk'
[ADB] Current device property 'ro.build.version.sdk': 25
[ADB] Device API level: 25
[AndroidDriver] No app sent in, not parsing package/activity
[ADB] Running 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 wait-for-device'
[ADB] Running 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell echo ping'
[AndroidDriver] Pushing settings apk to device...
[ADB] Getting install status for io.appium.settings
[ADB] Running 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell dumpsys package io.appium.settings'
[ADB] 'io.appium.settings' is installed
[ADB] Getting package info for 'io.appium.settings'
[ADB] Running 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell dumpsys package io.appium.settings'
[ADB] Cannot extract apk info using apkanalyzer. Falling back to aapt. Original error: Could not find 'apkanalyzer.bat' in ["D:\\software-fan\\android-sdk_r24.4.1-windows\\android-sdk-windows\\platform-tools\\apkanalyzer.bat","D:\\software-fan\\android-sdk_r24.4.1-windows\\android-sdk-windows\\emulator\\apkanalyzer.bat","D:\\software-fan\\android-sdk_r24.4.1-windows\\android-sdk-windows\\tools\\apkanalyzer.bat","D:\\software-fan\\android-sdk_r24.4.1-windows\\android-sdk-windows\\tools\\bin\\apkanalyzer.bat","D:\\software-fan\\android-sdk_r24.4.1-windows\\android-sdk-windows\\build-tools\\29.0.3\\apkanalyzer.bat"]. Do you have Android Build Tools installed at 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows'?
[ADB] Using 'aapt.exe' from 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\build-tools\29.0.3\aapt.exe'
[ADB] The version name of the installed 'io.appium.settings' is greater or equal to the application version name ('2.14.2' >= '2.14.2')
[ADB] There is no need to install/upgrade 'C:\Users\12446\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk'
[ADB] Getting IDs of all 'io.appium.settings' processes
[ADB] Running 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell 'pgrep --help; echo $?''
[ADB] Running 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell pgrep \^appium\\.settings\$'
[AndroidDriver] io.appium.settings is already running. There is no need to reset its permissions.
[ADB] Running 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell appops set io.appium.settings android\:mock_location allow'
[Logcat] Starting logcat capture
[ADB] Getting install status for io.appium.uiautomator2.server
[ADB] Running 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell dumpsys package io.appium.uiautomator2.server'
[ADB] 'io.appium.uiautomator2.server' is installed
[ADB] Getting package info for 'io.appium.uiautomator2.server'
[ADB] Running 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell dumpsys package io.appium.uiautomator2.server'
[ADB] Cannot extract apk info using apkanalyzer. Falling back to aapt. Original error: Could not find 'apkanalyzer.bat' in ["D:\\software-fan\\android-sdk_r24.4.1-windows\\android-sdk-windows\\platform-tools\\apkanalyzer.bat","D:\\software-fan\\android-sdk_r24.4.1-windows\\android-sdk-windows\\emulator\\apkanalyzer.bat","D:\\software-fan\\android-sdk_r24.4.1-windows\\android-sdk-windows\\tools\\apkanalyzer.bat","D:\\software-fan\\android-sdk_r24.4.1-windows\\android-sdk-windows\\tools\\bin\\apkanalyzer.bat","D:\\software-fan\\android-sdk_r24.4.1-windows\\android-sdk-windows\\build-tools\\29.0.3\\apkanalyzer.bat"]. Do you have Android Build Tools installed at 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows'?
[ADB] The version name of the installed 'io.appium.uiautomator2.server' is greater or equal to the application version name ('4.3.0' >= '4.3.0')
[UiAutomator2] io.appium.uiautomator2.server installation state: sameVersionInstalled
[ADB] Checking app cert for C:\Users\12446\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.3.0.apk
[ADB] Using 'apksigner.bat' from 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\build-tools\29.0.3\apksigner.bat'
[ADB] Starting 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\build-tools\29.0.3\apksigner.bat' with args '["verify","--print-certs","C:\\Users\\12446\\AppData\\Local\\Programs\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-uiautomator2-server\\apks\\appium-uiautomator2-server-v4.3.0.apk"]'
[ADB] apksigner stdout: Signer #1 certificate DN: EMAILADDRESS=android@android.com, CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US
[ADB] Signer #1 certificate SHA-256 digest: a40da80a59d170caa950cf15c18c454d47a39b26989d8b640ecd745ba71bf5dc
[ADB] Signer #1 certificate SHA-1 digest: 61ed377e85d386a8dfee6b864bd85b0bfaa5af81
[ADB] Signer #1 certificate MD5 digest: e89b158e4bcf988ebd09eb83f5378e87
[ADB] 
[ADB] 'C:\Users\12446\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.3.0.apk' is already signed.
[ADB] Getting install status for io.appium.uiautomator2.server.test
[ADB] Running 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell dumpsys package io.appium.uiautomator2.server.test'
[ADB] 'io.appium.uiautomator2.server.test' is installed
[ADB] Checking app cert for C:\Users\12446\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk
[ADB] Starting 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\build-tools\29.0.3\apksigner.bat' with args '["verify","--print-certs","C:\\Users\\12446\\AppData\\Local\\Programs\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-uiautomator2-server\\apks\\appium-uiautomator2-server-debug-androidTest.apk"]'
[ADB] apksigner stdout: Signer #1 certificate DN: EMAILADDRESS=android@android.com, CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US
[ADB] Signer #1 certificate SHA-256 digest: a40da80a59d170caa950cf15c18c454d47a39b26989d8b640ecd745ba71bf5dc
[ADB] Signer #1 certificate SHA-1 digest: 61ed377e85d386a8dfee6b864bd85b0bfaa5af81
[ADB] Signer #1 certificate MD5 digest: e89b158e4bcf988ebd09eb83f5378e87
[ADB] 
[ADB] 'C:\Users\12446\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk' is already signed.
[UiAutomator2] Server packages are not going to be (re)installed
[UiAutomator2] Waiting up to 30000ms for services to be available
[ADB] Running 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell pm list instrumentation'
[UiAutomator2] Instrumentation target 'io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner' is available
[UiAutomator2] Forwarding UiAutomator2 Server port 6790 to 8201
[ADB] Forwarding system: 8201 to device: 6790
[ADB] Running 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 forward tcp\:8201 tcp\:6790'
[UiAutomator2] No app capability. Assuming it is already on the device
[UiAutomator2] Performing shallow cleanup of automation leftovers
[UiAutomator2] The following obsolete sessions are still running: ["9e29b7c3-badf-4076-890c-8d46cf7a1b39"]
[UiAutomator2] Cleaning up the obsolete sessions
[Instrumentation] .
[ADB] Running 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell am force-stop io.appium.uiautomator2.server.test'
[UiAutomator2] Starting UIAutomator2 server 4.3.0
# 开始执行,运行 UiAutomator 
[UiAutomator2] Using UIAutomator2 server from 'C:\Users\12446\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.3.0.apk' and test from 'C:\Users\12446\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk'
[UiAutomator2] Waiting up to 30000ms for UiAutomator2 to be online...
[ADB] Creating ADB subprocess with args: ["-P",5037,"-s","127.0.0.1:62001","shell","am","instrument","-w","io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner"]
[Instrumentation] INSTRUMENTATION_RESULT: shortMsg=Process crashed.
[Instrumentation] INSTRUMENTATION_CODE: 0
[Instrumentation] The process has exited with code 0
[Instrumentation] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8201/wd/hub/status] with no body
[WD Proxy] Got an unexpected response with status undefined: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8201/wd/hub/status] with no body
[WD Proxy] Got response with status 200: {"sessionId":"None","value":{"ready":true,"message":"UiAutomator2 Server is ready to accept commands"}}
[UiAutomator2] The initialization of the instrumentation process took 2051ms
[WD Proxy] Matched '/session' to command name 'createSession'
[WD Proxy] Proxying [POST /session] to [POST http://localhost:8201/wd/hub/session] with body: {"capabilities":{"firstMatch":[{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","automationName":"UiAutomator2","platformVersion":"7.1.2","deviceName":"HUAWEI","appPackage":"com.lemon.lemonban","appActivity":"com.lemon.lemonban.activity.MainActivity","noReset":true},"platformName":"Android","automationName":"UiAutomator2","platformVersion":"7.1.2","deviceName":"127.0.0.1:62001","appPackage":"com.lemon.lemonban","appActivity":"com.lemon.lemonban.activity.MainActivity","noReset":true,"deviceUDID":"127.0.0.1:62001"}],"alwaysMatch":{}}}
[WD Proxy] Got response with status 200: {"sessionId":"38c3381c-c32f-412f-a546-c82d1fa6f2fa","value":{"sessionId":"38c3381c-c32f-412f-a546-c82d1fa6f2fa","capabilities":{"firstMatch":[{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","automationName":"UiAutomator2","platformVersion":"7.1.2","deviceName":"HUAWEI","appPackage":"com.lemon.lemonban","appActivity":"com.lemon.lemonban.activity.MainActivity","noReset":true},"platformName":"Android","automationName":"UiAutomator2","platformVersion":"7.1.2","deviceName":"127.0.0.1:62001","appPackage":"com.lemon.lemonban","appActivity":"com.lemon.lemonban.activity.MainActivity","noReset":true,"deviceUDID":"127.0.0.1:62001"}],"alwaysMatch":{}}}}
[WD Proxy] Determined the downstream protocol as 'W3C'
[WD Proxy] Proxying [GET /appium/device/info] to [GET http://localhost:8201/wd/hub/session/38c3381c-c32f-412f-a546-c82d1fa6f2fa/appium/device/info] with no body
[WD Proxy] Got response with status 200: {"sessionId":"38c3381c-c32f-412f-a546-c82d1fa6f2fa","value":{"androidId":"d803a6c9248dd29f","manufacturer":"HUAWEI","model":"VOG-AL10","brand":"HUAWEI","apiVersion":"25","platformVersion":"7.1.2","carrierName":"CMCC","realDisplaySize":"1080x1920","displayDensity":320,"networks":[{"type":1,"typeName":"WIFI","subtype":0,"subtypeName":"","isConnected":true,"detailedState":"CONNECTED","state":"CONNECTED","extraInfo":"\"WiredSSID\"","isAvailable":true,"isFailover":false,"isRoaming":false,"capabilities":{"transportTypes":"NET_CAPABILITY_SUPL","networkCapabilities":"","linkUpstreamBandwidthKbps":1048576,"linkDownBandwidthKbps":1048576,"signalStrength":-55,"networkSpecifier":null,"SSID":null}}],"locale":"zh_CN","timeZone":"Asia\/Shanghai"}}
[ADB] Running 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell dumpsys window'
[AndroidDriver] Screen already unlocked, doing nothing
[UiAutomator2] Starting 'com.lemon.lemonban/com.lemon.lemonban.activity.MainActivity and waiting for 'com.lemon.lemonban/com.lemon.lemonban.activity.MainActivity'
[ADB] Running 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell am start -W -n com.lemon.lemonban/com.lemon.lemonban.activity.MainActivity -S'
[WD Proxy] Proxying [GET /appium/device/pixel_ratio] to [GET http://localhost:8201/wd/hub/session/38c3381c-c32f-412f-a546-c82d1fa6f2fa/appium/device/pixel_ratio] with body: {}
[WD Proxy] Got response with status 200: {"sessionId":"38c3381c-c32f-412f-a546-c82d1fa6f2fa","value":2}
[WD Proxy] Matched '/appium/device/system_bars' to command name 'getSystemBars'
[WD Proxy] Proxying [GET /appium/device/system_bars] to [GET http://localhost:8201/wd/hub/session/38c3381c-c32f-412f-a546-c82d1fa6f2fa/appium/device/system_bars] with body: {}
[WD Proxy] Got response with status 200: {"sessionId":"38c3381c-c32f-412f-a546-c82d1fa6f2fa","value":{"statusBar":48}}
[WD Proxy] Matched '/window/current/size' to command name 'getWindowSize'
[WD Proxy] Proxying [GET /window/current/size] to [GET http://localhost:8201/wd/hub/session/38c3381c-c32f-412f-a546-c82d1fa6f2fa/window/current/size] with body: {}
[WD Proxy] Got response with status 200: {"sessionId":"38c3381c-c32f-412f-a546-c82d1fa6f2fa","value":{"height":1920,"width":1080}}
[Appium] New AndroidUiautomator2Driver session created successfully, session 7e471ba7-ec6a-4e18-b64e-7df671883f27 added to master session list
[BaseDriver] Event 'newSessionStarted' logged at 1644924685172 (19:31:25 GMT+0800 (中国标准时间))
[MJSONWP (7e471ba7)] Cached the protocol value 'MJSONWP' for the new session 7e471ba7-ec6a-4e18-b64e-7df671883f27
[MJSONWP (7e471ba7)] Responding to client with driver.createSession() result: {"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","automationName":"UiAutomator2","platformVersion":"7.1.2","deviceName":"HUAWEI","appPackage":"com.lemon.lemonban","appActivity":"com.lemon.lemonban.activity.MainActivity","noReset":true},"platformName":"Android","automationName":"UiAutomator2","platformVersion":"7.1.2","deviceName":"127.0.0.1:62001","appPackage":"com.lemon.lemonban","appActivity":"com.lemon.lemonban.activity.MainActivity","noReset":true,"deviceUDID":"127.0.0.1:62001","deviceApiLevel":25,"deviceScreenSize":"1080x1920","deviceScreenDensity":320,"deviceModel":"VOG-AL10","deviceManufacturer":"HUAWEI","pixelRatio":2,"statBarHeight":48,"viewportRect":{"left":0,"top":48,"width":1080,"height":1872}}
[HTTP] <-- POST /wd/hub/session 200 11054 ms - 969
[HTTP] 
[BaseDriver] Shutting down because we waited 60 seconds for a command
[UiAutomator2] Deleting UiAutomator2 session
[Appium] Closing session, cause was 'New Command Timeout of 60 seconds expired. Try customizing the timeout using the 'newCommandTimeout' desired capability'
[Appium] Removing session 64a1b095-c1fb-4572-8a27-6f226f17d461 from our master session list
[UiAutomator2] Deleting UiAutomator2 server session
[WD Proxy] Matched '/' to command name 'deleteSession'
[WD Proxy] Proxying [DELETE /] to [DELETE http://localhost:8200/wd/hub/session/9e29b7c3-badf-4076-890c-8d46cf7a1b39] with no body
[WD Proxy] Got response with status 200: {"sessionId":"9e29b7c3-badf-4076-890c-8d46cf7a1b39","value":null}
[ADB] Running 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell am force-stop com.lemon.lemonban'
[Logcat] Stopping logcat capture
[ADB] Removing forwarded port socket connection: 8200 
[ADB] Running 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 forward --remove tcp\:8200'
[Instrumentation] .
[Instrumentation] Time: 37.051
[Instrumentation] 
[Instrumentation] OK (1 test)
[Instrumentation] The process has exited with code 0
[BaseDriver] Shutting down because we waited 60 seconds for a command
[UiAutomator2] Deleting UiAutomator2 session
[Appium] Closing session, cause was 'New Command Timeout of 60 seconds expired. Try customizing the timeout using the 'newCommandTimeout' desired capability'
[Appium] Removing session 7e471ba7-ec6a-4e18-b64e-7df671883f27 from our master session list
[UiAutomator2] Deleting UiAutomator2 server session
[WD Proxy] Matched '/' to command name 'deleteSession'
[WD Proxy] Proxying [DELETE /] to [DELETE http://localhost:8201/wd/hub/session/38c3381c-c32f-412f-a546-c82d1fa6f2fa] with no body
[WD Proxy] Got an unexpected response with status undefined: {"code":"ECONNRESET"}
[UiAutomator2] Did not get confirmation UiAutomator2 deleteSession worked; Error was: UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to remote server. Original error: Error: socket hang up
[ADB] Running 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell am force-stop com.lemon.lemonban'
[Logcat] Stopping logcat capture
[ADB] Removing forwarded port socket connection: 8201 
[ADB] Running 'D:\software-fan\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 forward --remove tcp\:8201'

整个流程基本结束,现在把整个流程总结如下:

  1. 发送http请求到appium server
  2. appium server收到之后创建session
  3. 获取已连接的设备,并找到对应的Android版本号信息
  4. 获取io.appium.settings的状态,获取它的版本信息,确保其为最新的版本
  5. 获取settings_apk-debug.apk的状态,获取它的版本信息,确保其为最新的版本
  6. 获取 io.appium.uiautomator2.server的状态,获取它的版本信息,确保其为最新的版本
  7. 启动手机上的uiautomator.server的服务,然后设置将本地appium server 收到的指令从本地的8200端口,转发到设备的6790端口
  8. 跟手机创建会话
  9. 打开app
  10. 如果60s内appium server没有收到客户端的http请求,则主动关闭与客户端、手机端的会话,然后关闭app