appium的log詳細分析

Doris_Liu發表於2018-01-30

下面介紹appium日誌的大概分析

//啟動appium服務成功
2017-03-24 11:22:49:218 - info: [Appium] Welcome to Appium v1.6.3
2017-03-24 11:22:49:221 - info: [Appium] Non-default server args:
2017-03-24 11:22:49:222 - info: [Appium] log: 'C:\\Users\\LXG\\Desktop\\appium.log'
2017-03-24 11:22:49:270 - info: [Appium] Appium REST http interface listener started on 0.0.0.0:4723

//收到從指令碼傳遞的post請求,將desiredCapabilities引數全部傳遞給服務端
2017-03-24 11:23:57:842 - info: [HTTP] --> POST /wd/hub/session {"capabilities":{"desiredCapabilities":{"app":"C:\\Users\\LXG\\Desktop\

\zhihunew1.apk","noSign":true,"newCommandTimeout":600,"unicodeKeyboard":true,"platformName":"Android","deviceName":"xxx","resetKeyboard":true},"requiredCapabilities":

{}},"desiredCapabilities":{"app":"C:\\Users\\LXG\\Desktop\

\zhihunew1.apk","noSign":true,"newCommandTimeout":600,"unicodeKeyboard":true,"platformName":"Android","deviceName":"xxx","resetKeyboard":true},"requiredCapabilities":

{}}

//呼叫appiumdriver建立session
2017-03-24 11:23:57:845 - info: [debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"C:\\Users\\LXG\\Desktop\

\zhihunew1.apk","noSign":true,"newCommandTimeout":600,"unicodeKeyboard":true,"platformName":"Android","deviceName":"xxx","resetKeyboard":true},{},

{"desiredCapabilities":{"app":"C:\\Users\\LXG\\Desktop\

\zhihunew1.apk","noSign":true,"newCommandTimeout":600,"unicodeKeyboard":true,"platformName":"Android","deviceName":"xxx","resetKeyboard":true},"requiredCapabilities":

{}},null,null]
2017-03-24 11:23:57:849 - info: [Appium] Creating new AndroidDriver session
2017-03-24 11:23:57:849 - info: [Appium] Capabilities:
2017-03-24 11:23:57:851 - info: [Appium] app: 'C:\\Users\\LXG\\Desktop\\zhihunew1.apk'
2017-03-24 11:23:57:852 - info: [Appium] noSign: true
2017-03-24 11:23:57:853 - info: [Appium] newCommandTimeout: 600
2017-03-24 11:23:57:853 - info: [Appium] unicodeKeyboard: true
2017-03-24 11:23:57:853 - info: [Appium] platformName: 'Android'
2017-03-24 11:23:57:854 - info: [Appium] deviceName: 'xxx'
2017-03-24 11:23:57:855 - info: [Appium] resetKeyboard: true

//獲取androiddriver版本,建立一個session id,但此時實際上還沒有真正的建立成功
//Androiddriver版本1.10.38
2017-03-24 11:23:57:858 - info: [debug] [AndroidDriver] AndroidDriver version: 1.10.38
//生成的sessionid
2017-03-24 11:23:57:899 - info: [BaseDriver] Session created with session id: bbdf133b-9332-4b26-9556-6249f006d3a0

//獲取java版本
2017-03-24 11:23:57:901 - info: [debug] [AndroidDriver] Getting Java version
2017-03-24 11:23:58:007 - info: [AndroidDriver] Java version is: 1.8.0_40-ea

//檢查adb是否存在,通過配置的環境變數ANDROID_HOME去固定路徑下查詢
2017-03-24 11:23:58:011 - info: [ADB] Checking whether adb is present
2017-03-24 11:23:58:016 - info: [ADB] Using adb.exe from D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe

//查詢當前連線的裝置,通過【adb devices】命令,找到後並將該裝置的udid設定為要使用的
2017-03-24 11:23:58:017 - info: [AndroidDriver] Retrieving device list
2017-03-24 11:23:58:018 - info: [debug] [ADB] Trying to find a connected android device
2017-03-24 11:23:58:020 - info: [debug] [ADB] Getting connected devices...
//查詢到有一個裝置連線
2017-03-24 11:23:58:046 - info: [debug] [ADB] 1 device(s) connected
//使用這個裝置,獲取udid
2017-03-24 11:23:58:046 - info: [AndroidDriver] Using device: 127.0.0.1:62001
2017-03-24 11:23:58:048 - info: [ADB] Checking whether adb is present
2017-03-24 11:23:58:051 - info: [ADB] Using adb.exe from D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe
2017-03-24 11:23:58:053 - info: [debug] [ADB] Setting device id to 127.0.0.1:62001
//要安裝本地應用zhihunew1.apk,先檢查這個app是否實際存在,存在則繼續
2017-03-24 11:23:58:054 - info: [BaseDriver] Using local app 'C:\Users\LXG\Desktop\zhihunew1.apk'
2017-03-24 11:23:58:056 - info: [debug] [AndroidDriver] Checking whether app is actually present
2017-03-24 11:23:58:059 - info: [AndroidDriver] Starting Android session

//檢查裝置是否能夠正常響應adb命令,通過【adb shell echo ping】來檢查,裝置能夠正常響應列印出"ping"則認為裝置正常,這裡響應有個超時時間(預設是5秒)
2017-03-24 11:23:58:062 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","127.0.0.1:62001","wait-

for-device"]
2017-03-24 11:23:58:089 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:23:58:114 - info: [debug] [ADB] 1 device(s) connected

//adb shell echo ping 檢查裝置狀態
2017-03-24 11:23:58:115 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","echo","ping"]
2017-03-24 11:23:58:144 - info: [debug] [Logcat] Starting logcat capture

//安裝unicode.APK輸入法並將該輸入法裝置為當前預設的輸入法,因為unicodeKeyboard設定為true,安裝前先判斷是否已經存在於裝置上(注意這裡是因為修改了原始碼所以才會去判斷,沒改

過原始碼的是不判斷的,而是每次都會安裝)
2017-03-24 11:23:58:179 - info: [debug] [ADB] Getting install status for io.appium.android.ime
2017-03-24 11:23:58:187 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:23:58:233 - info: [debug] [ADB] 1 device(s) connected

2017-03-24 11:23:58:234 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","getprop","ro.build.version.sdk"]
2017-03-24 11:23:58:294 - info: [debug] [ADB] Device API level: 19
2017-03-24 11:23:58:296 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:23:58:347 - info: [debug] [ADB] 1 device(s) connected
2017-03-24 11:23:58:353 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","pm","list","packages","-3","io.appium.android.ime"]
2017-03-24 11:23:59:109 - info: [debug] [ADB] App is not installed
2017-03-24 11:23:59:110 - info: [debug] [AndroidDriver] Enabling Unicode keyboard support
2017-03-24 11:23:59:113 - info: [debug] [AndroidDriver] Pushing unicode ime to device...

//安裝UnicodeIME-debug.apk 安裝IME,就是我們所說的輸入法,存放地址為
2017-03-24 11:23:59:117 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-
s","127.0.0.1:62001","install","C:\\Users\\LXG\\AppData\\Roaming\\npm\\node_modules\\appium\\node_modules\\appium-android-ime\\bin\\UnicodeIME-debug.apk"]
2017-03-24 11:24:00:219 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:24:00:260 - info: [debug] [ADB] 1 device(s) connected
//adb shell settings get secure default_input_method 獲取當前的輸入法
2017-03-24 11:24:00:261 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","settings","get","secure","default_input_method"]
2017-03-24 11:24:01:004 - info: [debug] [AndroidDriver] Unsetting previous IME com.example.android.softkeyboard/.SoftKeyboard

//設定輸入法為appium所用的輸入法
2017-03-24 11:24:01:006 - info: [debug] [AndroidDriver] Setting IME to 'io.appium.android.ime/.UnicodeIME'
2017-03-24 11:24:01:007 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:24:01:041 - info: [debug] [ADB] 1 device(s) connected
2017-03-24 11:24:01:042 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","ime","enable","io.appium.android.ime/.UnicodeIME"]
2017-03-24 11:24:01:857 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:24:01:892 - info: [debug] [ADB] 1 device(s) connected
2017-03-24 11:24:01:893 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","ime","set","io.appium.android.ime/.UnicodeIME"]

//安裝settings app,輔助設定裝置的網路,因為unicodeKeyboard設定為true,安裝前先判斷是否已經存在於裝置上(注意這裡是因為修改了原始碼所以才會去判斷,沒改過原始碼的是不判斷的

,而是每次都會安裝)
2017-03-24 11:24:02:657 - info: [debug] [ADB] Getting install status for io.appium.settings
2017-03-24 11:24:02:658 - info: [debug] [ADB] Device API level: 19
2017-03-24 11:24:02:661 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:24:02:691 - info: [debug] [ADB] 1 device(s) connected
2017-03-24 11:24:02:692 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","pm","list","packages","-3","io.appium.settings"]
2017-03-24 11:24:03:536 - info: [debug] [ADB] App is not installed
2017-03-24 11:24:03:540 - info: [debug] [AndroidDriver] Pushing settings apk to device... this is shamo
2017-03-24 11:24:03:541 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","install","C:\\Users\\LXG\\AppData\\Roaming\\npm\\node_modules\\appium\\node_modules\\io.appium.settings\\bin\\settings_apk-debug.apk"]

//安裝unlock app,輔助裝置解鎖,因為unicodeKeyboard設定為true,安裝前先判斷是否已經存在於裝置上(注意這裡是因為修改了原始碼所以才會去判斷,沒改過原始碼的是不判斷的,而是每

次都會安裝)
2017-03-24 11:24:04:762 - info: [debug] [ADB] Getting install status for io.appium.unlock
2017-03-24 11:24:04:763 - info: [debug] [ADB] Device API level: 19
2017-03-24 11:24:04:765 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:24:04:803 - info: [debug] [ADB] 1 device(s) connected
2017-03-24 11:24:04:804 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","pm","list","packages","-3","io.appium.unlock"]
2017-03-24 11:24:06:037 - info: [debug] [ADB] App is not installed
2017-03-24 11:24:06:038 - info: [debug] [AndroidDriver] Pushing unlock helper app to device...
2017-03-24 11:24:06:038 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","install","C:\\Users\\LXG\\AppData\\Roaming\\npm\\node_modules\\appium\\node_modules\\appium-unlock\\bin\\unlock_apk-debug.apk"]
2017-03-24 11:24:07:914 - info: [ADB] Getting device platform version
2017-03-24 11:24:07:914 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:24:07:965 - info: [debug] [ADB] 1 device(s) connected

//到此為止三個輔助apk已經安裝完畢和設計完畢

//adb shell getprop ro.build.version.release 獲取Android系統屬性,系統版本
2017-03-24 11:24:07:970 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","getprop","ro.build.version.release"]
2017-03-24 11:24:08:023 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:24:08:057 - info: [debug] [ADB] 1 device(s) connected

//獲取當前adb視窗
//使用命令adb shell dumpsys window windows | findstr "mCurrentFocus"
2017-03-24 11:24:08:058 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","dumpsys","window"]

//appiumunlock螢幕解鎖,螢幕已經是解鎖狀態,所以什麼也沒做,如果螢幕不是解鎖狀態會解鎖
2017-03-24 11:24:08:110 - info: [AndroidDriver] Screen already unlocked, doing nothing

//使用aapt命令解析apk包得到apppackage和appactivity,用來啟動應用
//manifest是安卓專案的一個配置檔案裡面有包名和activity名,都是總這個檔案中解析來的
2017-03-24 11:24:08:111 - info: [debug] [AndroidDriver] Parsing package and activity from app manifest
//檢查appt是否到位,因為要用到他
2017-03-24 11:24:08:114 - info: [ADB] Checking whether aapt is present
2017-03-24 11:24:08:120 - info: [ADB] Using aapt.exe from D:\android-sdk_r24.4.1-windows\sdk\build-tools\23.0.2\aapt.exe
2017-03-24 11:24:08:121 - info: [ADB] Extracting package and launch activity from manifest
2017-03-24 11:24:08:387 - info: [debug] [ADB] badging package: com.zhihu.android
2017-03-24 11:24:08:387 - info: [debug] [ADB] badging act: com.zhihu.android.app.ui.activity.MainActivity
2017-03-24 11:24:08:388 - info: [debug] [AndroidDriver] Parsed package and activity are: com.zhihu.android/com.zhihu.android.app.ui.activity.

//判斷要測試的app是否已經安裝,如果已經安裝就重置,沒安裝就重新安裝
//apk放在了/data/local/tmp/目錄下,進行了md5的加密
2017-03-24 11:24:08:616 - info: [AndroidDriver] Remote apk path is /data/local/tmp/96c0b9574b2a2af7cc0999d321055f7c.apk
2017-03-24 11:24:08:620 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:24:08:655 - info: [debug] [ADB] 1 device(s) connected

//adb shell ls 檢視目錄
//檢查/data/local/tmp/96c0b9574b2a2af7cc0999d321055f7c.apk是否存在
2017-03-24 11:24:08:659 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","ls","/data/local/tmp/96c0b9574b2a2af7cc0999d321055f7c.apk"]
//檢查是否安裝apk
2017-03-24 11:24:08:717 - info: [debug] [AndroidDriver] Checking if app is installed
//獲取知乎的安裝狀態
2017-03-24 11:24:08:719 - info: [debug] [ADB] Getting install status for com.zhihu.android
2017-03-24 11:24:08:720 - info: [debug] [ADB] Device API level: 19
2017-03-24 11:24:08:721 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:24:08:762 - info: [debug] [ADB] 1 device(s) connected

//命令adb shell pm list packages -3 (列舉出-3表示第三方應用的)
//命令adb shell pm list packages 列舉出所有報名
2017-03-24 11:24:08:763 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","pm","list","packages","-3","com.zhihu.android"]
//檢查已經安裝了apk
2017-03-24 11:24:10:095 - info: [debug] [ADB] App is installed

2017-03-24 11:24:10:099 - info: [AndroidDriver] Apk is already on remote and installed, resetting
//要進行重置,停止執行,noreset引數沒有設定為true就會重置應用
2017-03-24 11:24:10:105 - info: [debug] [AndroidDriver] Running fast reset (stop and clear)
2017-03-24 11:24:10:107 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:24:10:158 - info: [debug] [ADB] 1 device(s) connected
//adb shell am force-stop +包名強制停止應用
2017-03-24 11:24:10:159 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","am","force-stop","com.zhihu.android"]
2017-03-24 11:24:11:383 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:24:11:423 - info: [debug] [ADB] 1 device(s) connected

//abd shell pm clear +包名 重置應用
2017-03-24 11:24:11:426 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","pm","clear","com.zhihu.android"]
2017-03-24 11:24:12:710 - info: [debug] [AndroidDriver] Extracting strings from apk C:\Users\LXG\Desktop\zhihunew1.apk null C:\Users\LXG\AppData\Local\Temp

\com.zhihu.android
//語言預設
2017-03-24 11:24:12:712 - info: [debug] [ADB] Extracting strings for language: default
2017-03-24 11:24:12:714 - info: [debug] [ADB] Device API level: 19
2017-03-24 11:24:12:716 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:24:12:757 - info: [debug] [ADB] 1 device(s) connected
2017-03-24 11:24:12:758 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

//adb shell getprop persist.sys.language 獲取裝置語言
s","127.0.0.1:62001","shell","getprop","persist.sys.language"]
2017-03-24 11:24:12:819 - info: [debug] [ADB] Current device property 'persist.sys.language': zh
2017-03-24 11:24:14:843 - info: [debug] [ADB] Reading strings from converted strings.json
2017-03-24 11:24:14:846 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","push","C:\\Users\\LXG\\AppData\\Local\\Temp\\com.zhihu.android\\strings.json","/data/local/tmp"]

//轉發電腦的4724埠到裝置的4724埠上,並開啟裝置上的基於appiumbootstrap的socket服務
2017-03-24 11:24:14:893 - info: [debug] [AndroidBootstrap] Watching for bootstrap disconnect
2017-03-24 11:24:14:895 - info: [debug] [ADB] Forwarding system: 4724 to device: 4724
2017-03-24 11:24:14:897 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","forward","tcp:4724","tcp:4724"]
2017-03-24 11:24:14:908 - info: [debug] [UiAutomator] Starting UiAutomator
2017-03-24 11:24:14:909 - info: [debug] [UiAutomator] Moving to state 'starting'
2017-03-24 11:24:14:911 - info: [debug] [UiAutomator] Parsing uiautomator jar
2017-03-24 11:24:14:912 - info: [debug] [UiAutomator] Found jar name: 'AppiumBootstrap.jar'
2017-03-24 11:24:14:913 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","push","C:\\Users\\LXG\\AppData\\Roaming\\npm\\node_modules\\appium\\node_modules\\appium-android-bootstrap\\bootstrap\\bin\

\AppiumBootstrap.jar","/data/local/tmp/"]
2017-03-24 11:24:14:987 - info: [debug] [ADB] Attempting to kill all uiautomator processes
2017-03-24 11:24:14:989 - info: [debug] [ADB] Getting all processes with uiautomator
2017-03-24 11:24:14:990 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:24:15:025 - info: [debug] [ADB] 1 device(s) connected
2017-03-24 11:24:15:028 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","ps"]
2017-03-24 11:24:15:082 - info: [ADB] No uiautomator process found to kill, continuing...
2017-03-24 11:24:15:084 - info: [debug] [UiAutomator] Starting UIAutomator
2017-03-24 11:24:15:088 - info: [debug] [ADB] Creating ADB subprocess with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","uiautomator","runtest","AppiumBootstrap.jar","-c","io.appium.android.bootstrap.Bootstrap","-e","pkg","com.zhihu.android","-

e","disableAndroidWatchers",false,"-e","acceptSslCerts",false]
2017-03-24 11:24:16:130 - info: [debug] [UiAutomator] Moving to state 'online'
2017-03-24 11:24:16:137 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Registered crash watchers.
2017-03-24 11:24:16:141 - info: [AndroidBootstrap] Android bootstrap socket is now connected
2017-03-24 11:24:16:143 - info: [debug] [ADB] Device API level: 19
2017-03-24 11:24:16:144 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:24:16:157 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Client connected

//啟動應用,並獲取啟動的介面activity與起始的activity進行比對,如果一致則認為啟動成功,如果不一致則會在20秒內不斷去對比,直到超時
2017-03-24 11:24:16:190 - info: [debug] [ADB] 1 device(s) connected
2017-03-24 11:24:16:192 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","am","start","-W","-n","com.zhihu.android/com.zhihu.android.app.ui.activity.MainActivity","-S","-a","android.intent.action.MAIN","-

c","android.intent.category.LAUNCHER","-f","0x10200000"]

//等待包名和activity成為當前介面的焦點(主要視窗)
2017-03-24 11:24:22:793 - info: [debug] [ADB] Waiting for pkg: 'com.zhihu.android' and activity: 'com.zhihu.android.app.ui.activity.MainActivity' to be focused

////其他匹配的報名和activity名,有可能也是這幾個
2017-03-24 11:24:22:795 - info: [debug] [ADB] Possible activities, to be checked: com.zhihu.android.app.ui.activity.MainActivity, .app.ui.activity.MainActivity,

.com.zhihu.android.app.ui.activity.MainActivity
2017-03-24 11:24:22:797 - info: [debug] [ADB] Getting focused package and activity
2017-03-24 11:24:22:798 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:24:22:846 - info: [debug] [ADB] 1 device(s) connected
2017-03-24 11:24:22:847 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","dumpsys","window","windows"]

//發現了包名和activity,說明成功了,只是和他猜測的可能的一種apk匹配了
2017-03-24 11:24:22:973 - info: [debug] [ADB] Found package: 'com.zhihu.android' and activity: '.app.ui.activity.MainActivity'
2017-03-24 11:24:22:977 - info: [Appium] New AndroidDriver session created successfully, session bbdf133b-9332-4b26-9556-6249f006d3a0 added to master session list
2017-03-24 11:24:22:981 - info: [debug] [MJSONWP] Responding to client with driver.createSession() result:

{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextE

nabled":false,"warnings":{},"desired":{"app":"C:\\Users\\LXG\\Desktop\

\zhihunew1.apk","noSign":true,"newCommandTimeout":600,"unicodeKeyboard":true,"platformName":"Android","deviceName":"xxx","resetKeyboard":true},"app":"C:\\Users\\LXG\

\Desktop\

\zhihunew1.apk","noSign":true,"newCommandTimeout":600,"unicodeKeyboard":true,"platformName":"Android","deviceName":"127.0.0.1:62001","resetKeyboard":true,"deviceUDID":

"127.0.0.1:62001","platformVersion":"4.4.2","appPackage":"com.zhihu.android","appWaitPackage":"com.zhihu.android","appActivity":"com.zhihu.android.app.ui.activity.Main

Activity","appWaitActivity":"com.zhihu.android.app.ui.activity.MainActivity"}
2017-03-24 11:24:22:993 - info: [HTTP] <-- POST /wd/hub/session 200 25144 ms - 894
2017-03-24 11:24:23:083 - info: [HTTP] --> GET /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0 {}

//建立成功,sessionid是57342fdf-b56a-4bf4-a9b6-d52bc1b731da added
2017-03-24 11:24:23:092 - info: [debug] [MJSONWP] Calling AppiumDriver.getSession() with args: ["bbdf133b-9332-4b26-9556-6249f006d3a0"]
2017-03-24 11:24:23:117 - info: [debug] [MJSONWP] Responding to client with driver.getSession() result:

{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextE

nabled":false,"warnings":{},"desired":{"app":"C:\\Users\\LXG\\Desktop\

\zhihunew1.apk","noSign":true,"newCommandTimeout":600,"unicodeKeyboard":true,"platformName":"Android","deviceName":"xxx","resetKeyboard":true},"app":"C:\\Users\\LXG\

\Desktop\

\zhihunew1.apk","noSign":true,"newCommandTimeout":600,"unicodeKeyboard":true,"platformName":"Android","deviceName":"127.0.0.1:62001","resetKeyboard":true,"deviceUDID":

"127.0.0.1:62001","platformVersion":"4.4.2","appPackage":"com.zhihu.android","appWaitPackage":"com.zhihu.android","appActivity":"com.zhihu.android.app.ui.activity.Main

Activity","appWaitActivity":"com.zhihu.android.app.ui.activity.MainActivity"}
2017-03-24 11:24:23:145 - info: [HTTP] <-- GET /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0 200 40 ms - 894
2017-03-24 11:24:23:159 - info: [HTTP] --> GET /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0 {}
2017-03-24 11:24:23:164 - info: [debug] [MJSONWP] Calling AppiumDriver.getSession() with args: ["bbdf133b-9332-4b26-9556-6249f006d3a0"]
2017-03-24 11:24:23:173 - info: [debug] [MJSONWP] Responding to client with driver.getSession() result:

{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextE

nabled":false,"warnings":{},"desired":{"app":"C:\\Users\\LXG\\Desktop\

\zhihunew1.apk","noSign":true,"newCommandTimeout":600,"unicodeKeyboard":true,"platformName":"Android","deviceName":"xxx","resetKeyboard":true},"app":"C:\\Users\\LXG\

\Desktop\

\zhihunew1.apk","noSign":true,"newCommandTimeout":600,"unicodeKeyboard":true,"platformName":"Android","deviceName":"127.0.0.1:62001","resetKeyboard":true,"deviceUDID":

"127.0.0.1:62001","platformVersion":"4.4.2","appPackage":"com.zhihu.android","appWaitPackage":"com.zhihu.android","appActivity":"com.zhihu.android.app.ui.activity.Main

Activity","appWaitActivity":"com.zhihu.android.app.ui.activity.MainActivity"}
2017-03-24 11:24:23:183 - info: [HTTP] <-- GET /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0 200 26 ms - 894

//指令碼通過post請求傳遞要查詢元素,appium服務端進行接收,接收後解析引數並將引數通過4724埠再次傳遞給AndroidBootstrap,AndroidBootstrap完成操作後將結果再逐層返回
2017-03-24 11:24:28:186 - info: [HTTP] --> POST /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0/element {"using":"id","value":"android:id/button3"}
2017-03-24 11:24:28:188 - info: [debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["id","android:id/button3","bbdf133b-9332-4b26-9556-6249f006d3a0"]
2017-03-24 11:24:28:197 - info: [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2017-03-24 11:24:28:200 - info: [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2017-03-24 11:24:28:201 - info: [debug] [BaseDriver] Waiting up to 0 ms for condition
2017-03-24 11:24:28:206 - info: [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":

{"strategy":"id","selector":"android:id/button3","context":"","multiple":false}}
2017-03-24 11:24:28:210 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":

{"strategy":"id","selector":"android:id/button3","context":"","multiple":false}}
2017-03-24 11:24:28:211 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
2017-03-24 11:24:28:213 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
2017-03-24 11:24:28:214 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'android:id/button3' using 'ID' with the contextId: '' multiple: false
2017-03-24 11:24:28:215 - info: [debug] [AndroidBootstrap] [UIAUTO STDOUT] [APPIUM-UIAUTO] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=androi
2017-03-24 11:24:28:216 - info: [debug] [AndroidBootstrap] [UIAUTO STDOUT] d:id/button3][/APPIUM-UIAUTO]


2017-03-24 11:24:28:306 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
2017-03-24 11:24:28:306 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'android:id/button3' using 'ID' with the contextId: '' multiple: false
2017-03-24 11:24:28:308 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=android:id/button3]
2017-03-24 11:24:28:312 - info: [debug] [AndroidBootstrap] Received command result from bootstrap
2017-03-24 11:24:28:334 - info: [HTTP] <-- POST /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0/element 500 144 ms - 164
2017-03-24 11:24:28:336 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":"No element found","status":7}
2017-03-24 11:24:28:405 - info: [HTTP] --> POST /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0/element {"using":"id","value":"com.zhihu.android:id/email_text"}
2017-03-24 11:24:28:406 - info: [debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["id","com.zhihu.android:id/email_text","bbdf133b-9332-4b26-9556-

6249f006d3a0"]
2017-03-24 11:24:28:407 - info: [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2017-03-24 11:24:28:408 - info: [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2017-03-24 11:24:28:409 - info: [debug] [BaseDriver] Waiting up to 0 ms for condition
2017-03-24 11:24:28:413 - info: [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":

{"strategy":"id","selector":"com.zhihu.android:id/email_text","context":"","multiple":false}}
2017-03-24 11:24:28:418 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":

{"strategy":"id","selector":"com.zhihu.android:id/email_text","context":"","multiple":false}}
2017-03-24 11:24:28:418 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
2017-03-24 11:24:28:419 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
2017-03-24 11:24:28:419 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.zhihu.android:id/email_text' using 'ID' with the contextId: '' multiple: false
2017-03-24 11:24:28:420 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.zhihu.android:id/email_text]
2017-03-24 11:24:30:093 - info: [debug] [AndroidBootstrap] Received command result from bootstrap
2017-03-24 11:24:30:095 - info: [debug] [MJSONWP] Responding to client with driver.findElement() result: {"ELEMENT":"1"}
2017-03-24 11:24:30:097 - info: [HTTP] <-- POST /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0/element 200 1694 ms - 87
2017-03-24 11:24:30:097 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":{"ELEMENT":"1"},"status":0}
2017-03-24 11:24:30:116 - info: [HTTP] --> POST /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0/element/1/click {"id":"1"}
2017-03-24 11:24:30:117 - info: [debug] [MJSONWP] Calling AppiumDriver.click() with args: ["1","bbdf133b-9332-4b26-9556-6249f006d3a0"]
2017-03-24 11:24:30:122 - info: [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:click","params":{"elementId":"1"}}
2017-03-24 11:24:30:125 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"1"}}
2017-03-24 11:24:30:127 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
2017-03-24 11:24:30:129 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: click
2017-03-24 11:24:30:383 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":true,"status":0}
2017-03-24 11:24:30:385 - info: [debug] [AndroidBootstrap] Received command result from bootstrap
2017-03-24 11:24:30:387 - info: [debug] [MJSONWP] Responding to client with driver.click() result: true
2017-03-24 11:24:30:394 - info: [HTTP] <-- POST /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0/element/1/click 200 277 ms - 76
2017-03-24 11:24:30:396 - info: [HTTP] --> POST /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0/element

{"using":"id","value":"com.zhihu.android:id/email_input_view"}
2017-03-24 11:24:30:398 - info: [debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["id","com.zhihu.android:id/email_input_view","bbdf133b-9332-4b26-9556

-6249f006d3a0"]
2017-03-24 11:24:30:403 - info: [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2017-03-24 11:24:30:404 - info: [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2017-03-24 11:24:30:405 - info: [debug] [BaseDriver] Waiting up to 0 ms for condition
2017-03-24 11:24:30:406 - info: [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":

{"strategy":"id","selector":"com.zhihu.android:id/email_input_view","context":"","multiple":false}}
2017-03-24 11:24:30:410 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":

{"strategy":"id","selector":"com.zhihu.android:id/email_input_view","context":"","multiple":false}}
2017-03-24 11:24:30:411 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
2017-03-24 11:24:30:412 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
2017-03-24 11:24:30:413 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.zhihu.android:id/email_input_view' using 'ID' with the contextId: '' multiple:

false
2017-03-24 11:24:30:414 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.zhihu.android:id/email_input_view]
2017-03-24 11:24:31:001 - info: [debug] [AndroidBootstrap] Received command result from bootstrap
2017-03-24 11:24:31:002 - info: [debug] [MJSONWP] Responding to client with driver.findElement() result: {"ELEMENT":"2"}
2017-03-24 11:24:31:007 - info: [HTTP] <-- POST /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0/element 200 608 ms - 87
2017-03-24 11:24:31:009 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":{"ELEMENT":"2"},"status":0}
2017-03-24 11:24:31:012 - info: [HTTP] --> POST /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0/element/2/value {"id":"2","value":["crazysand_001@163.com"]}
2017-03-24 11:24:31:014 - info: [debug] [MJSONWP] Calling AppiumDriver.setValue() with args: [["crazysand_001@163.com"],"2","bbdf133b-9332-4b26-9556-6249f006d3a0"]
2017-03-24 11:24:31:020 - info: [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:setText","params":

{"elementId":"2","text":"crazysand_001@163.com","replace":false,"unicodeKeyboard":true}}
2017-03-24 11:24:31:023 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:setText","params":

{"elementId":"2","text":"crazysand_001@163.com","replace":false,"unicodeKeyboard":true}}
2017-03-24 11:24:31:024 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
2017-03-24 11:24:31:024 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: setText
2017-03-24 11:24:31:025 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using element passed in: 2
2017-03-24 11:24:31:058 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Attempting to clear using UiObject.clearText().
2017-03-24 11:24:33:407 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Text remains after clearing, but it appears to be hint text.
2017-03-24 11:24:33:413 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Text not cleared. Assuming remainder is hint text.
2017-03-24 11:24:33:414 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Sending plain text to element: crazysand_001@163.com
2017-03-24 11:24:36:458 - info: [debug] [AndroidBootstrap] Received command result from bootstrap
2017-03-24 11:24:36:460 - info: [debug] [MJSONWP] Responding to client with driver.setValue() result: true
2017-03-24 11:24:36:464 - info: [HTTP] <-- POST /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0/element/2/value 200 5450 ms - 76
2017-03-24 11:24:36:464 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":true,"status":0}
2017-03-24 11:24:36:471 - info: [HTTP] --> POST /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0/element {"using":"id","value":"com.zhihu.android:id/password"}
2017-03-24 11:24:36:472 - info: [debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["id","com.zhihu.android:id/password","bbdf133b-9332-4b26-9556-

6249f006d3a0"]
2017-03-24 11:24:36:477 - info: [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2017-03-24 11:24:36:480 - info: [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2017-03-24 11:24:36:481 - info: [debug] [BaseDriver] Waiting up to 0 ms for condition
2017-03-24 11:24:36:484 - info: [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":

{"strategy":"id","selector":"com.zhihu.android:id/password","context":"","multiple":false}}
2017-03-24 11:24:36:488 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":

{"strategy":"id","selector":"com.zhihu.android:id/password","context":"","multiple":false}}
2017-03-24 11:24:36:488 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
2017-03-24 11:24:36:489 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
2017-03-24 11:24:36:489 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.zhihu.android:id/password' using 'ID' with the contextId: '' multiple: false
2017-03-24 11:24:36:490 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.zhihu.android:id/password]
2017-03-24 11:24:37:522 - info: [debug] [AndroidBootstrap] Received command result from bootstrap
2017-03-24 11:24:37:524 - info: [debug] [MJSONWP] Responding to client with driver.findElement() result: {"ELEMENT":"3"}
2017-03-24 11:24:37:528 - info: [HTTP] <-- POST /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0/element 200 1056 ms - 87
2017-03-24 11:24:37:529 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":{"ELEMENT":"3"},"status":0}
2017-03-24 11:24:37:535 - info: [HTTP] --> POST /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0/element/3/value {"id":"3","value":["12345678"]}
2017-03-24 11:24:37:539 - info: [debug] [MJSONWP] Calling AppiumDriver.setValue() with args: [["12345678"],"3","bbdf133b-9332-4b26-9556-6249f006d3a0"]
2017-03-24 11:24:37:543 - info: [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:setText","params":

{"elementId":"3","text":"12345678","replace":false,"unicodeKeyboard":true}}
2017-03-24 11:24:37:546 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:setText","params":

{"elementId":"3","text":"12345678","replace":false,"unicodeKeyboard":true}}
2017-03-24 11:24:37:549 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
2017-03-24 11:24:37:550 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: setText
2017-03-24 11:24:37:551 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using element passed in: 3
2017-03-24 11:24:37:567 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Attempting to clear using UiObject.clearText().
2017-03-24 11:24:39:905 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Text remains after clearing, but it appears to be hint text.
2017-03-24 11:24:39:910 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Text not cleared. Assuming remainder is hint text.
2017-03-24 11:24:39:910 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Sending plain text to element: 12345678
2017-03-24 11:24:42:236 - info: [debug] [AndroidBootstrap] Received command result from bootstrap
2017-03-24 11:24:42:240 - info: [debug] [MJSONWP] Responding to client with driver.setValue() result: true
2017-03-24 11:24:42:252 - info: [HTTP] <-- POST /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0/element/3/value 200 4710 ms - 76
2017-03-24 11:24:42:254 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":true,"status":0}
2017-03-24 11:24:52:257 - info: [HTTP] --> POST /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0/element {"using":"id","value":"com.zhihu.android:id/btn_progress"}
2017-03-24 11:24:52:260 - info: [debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["id","com.zhihu.android:id/btn_progress","bbdf133b-9332-4b26-9556-

6249f006d3a0"]
2017-03-24 11:24:52:264 - info: [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2017-03-24 11:24:52:267 - info: [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2017-03-24 11:24:52:269 - info: [debug] [BaseDriver] Waiting up to 0 ms for condition
2017-03-24 11:24:52:270 - info: [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":

{"strategy":"id","selector":"com.zhihu.android:id/btn_progress","context":"","multiple":false}}
2017-03-24 11:24:52:274 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":

{"strategy":"id","selector":"com.zhihu.android:id/btn_progress","context":"","multiple":false}}
2017-03-24 11:24:52:276 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
2017-03-24 11:24:52:277 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
2017-03-24 11:24:52:278 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.zhihu.android:id/btn_progress' using 'ID' with the contextId: '' multiple:

false
2017-03-24 11:24:52:279 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.zhihu.android:id/btn_progress]
2017-03-24 11:24:52:308 - info: [debug] [AndroidBootstrap] Received command result from bootstrap
2017-03-24 11:24:52:310 - info: [debug] [MJSONWP] Responding to client with driver.findElement() result: {"ELEMENT":"4"}
2017-03-24 11:24:52:316 - info: [HTTP] <-- POST /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0/element 200 57 ms - 87
2017-03-24 11:24:52:317 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":{"ELEMENT":"4"},"status":0}
2017-03-24 11:24:52:319 - info: [HTTP] --> POST /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0/element/4/click {"id":"4"}
2017-03-24 11:24:52:320 - info: [debug] [MJSONWP] Calling AppiumDriver.click() with args: ["4","bbdf133b-9332-4b26-9556-6249f006d3a0"]
2017-03-24 11:24:52:323 - info: [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:click","params":{"elementId":"4"}}
2017-03-24 11:24:52:329 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"4"}}
2017-03-24 11:24:52:331 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
2017-03-24 11:24:52:332 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: click
2017-03-24 11:24:52:473 - info: [debug] [AndroidBootstrap] Received command result from bootstrap
2017-03-24 11:24:52:475 - info: [debug] [MJSONWP] Responding to client with driver.click() result: true
2017-03-24 11:24:52:478 - info: [HTTP] <-- POST /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0/element/4/click 200 157 ms - 76
2017-03-24 11:24:52:479 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":true,"status":0}
2017-03-24 11:25:00:481 - info: [HTTP] --> GET /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0/source {}
2017-03-24 11:25:00:482 - info: [debug] [MJSONWP] Calling AppiumDriver.getPageSource() with args: ["bbdf133b-9332-4b26-9556-6249f006d3a0"]
2017-03-24 11:25:00:488 - info: [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"source","params":{}}
2017-03-24 11:25:00:492 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"source","params":{}}
2017-03-24 11:25:00:492 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
2017-03-24 11:25:00:494 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: source
2017-03-24 11:25:00:718 - info: [debug] [AndroidBootstrap] Received command result from bootstrap
2017-03-24 11:25:00:719 - info: [debug] [AndroidBootstrap] Stream still not complete, waiting
2017-03-24 11:25:00:725 - info: [debug] [AndroidBootstrap] Received command result from bootstrap
2017-03-24 11:25:00:727 - info: [debug] [AndroidBootstrap] Stream still not complete, waiting
2017-03-24 11:25:00:732 - info: [debug] [AndroidBootstrap] Received command result from bootstrap
2017-03-24 11:25:00:735 - info: [debug] [AndroidBootstrap] Stream still not complete, waiting
//刪除了一些
2017-03-24 11:25:00:737 - info: [debug] [AndroidBootstrap] Received command result from bootstrap
2017-03-24 11:25:00:746 - info: [debug] [MJSONWP] Responding to client with driver.getPageSource() result: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><hierarchy

rotation=\"0\"><android.widget.FrameLayout index=\"0\" text=\"\" class=\"android.widget.FrameLayout\" package=\"com.zhihu.android\" content-desc=\"\" checkable=

\"false\" checked=\"false\" clickable=\"false\" enabled=\"true\" focusable=\"false\" focused=\"false\" scrollable=\"false\" long-clickable=\"false\" password=\"false\"

selected=\"false\" bounds=\"[0,0][720,1280]\" resource-id=\"\" instance=\"0\"><android.widget.LinearLayout index=\"0\" text=\"\" class=\"android.widget.LinearLayout\"

package=\"com.zhihu.android\" content-desc=\"\" checkable=\"false\" checked=\"false\" clickable=\"false\" enabled=\"true\" focusable=\"false\" focused=\"false\"

scrollable=\"false\" long-clickable=\"false\" password=\"false\" selected=\"false\" bounds=\"[0,0][720,1280]\" resource-id=\"\" instance=

\"0\"><android.widget.FrameLayout index=\"0\" text=\"\" class=\"android.widget.FrameLayout\" package=\"com.zhihu.android\" content-desc=\"\" checkable=\"false\"

checked=\"fal...
2017-03-24 11:25:00:753 - info: [HTTP] <-- GET /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0/source 200 268 ms - 16445
2017-03-24 11:25:00:758 - info: [HTTP] --> DELETE /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0 {}

//driver.quit斷開連線,斷開前要做幾件事
//1. 將輸入法重置回裝置原來的
//2. 按一下home鍵
//3. 關閉裝置上的AndroidBootstrap socket服務
//4. 強行終止測試app,強行終止unlock app程式
2017-03-24 11:25:00:759 - info: [debug] [MJSONWP] Calling AppiumDriver.deleteSession() with args: ["bbdf133b-9332-4b26-9556-6249f006d3a0"]
2017-03-24 11:25:00:761 - info: [debug] [AndroidDriver] Shutting down Android driver
2017-03-24 11:25:00:768 - info: [debug] [AndroidDriver] Resetting IME to com.example.android.softkeyboard/.SoftKeyboard
2017-03-24 11:25:00:769 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:25:00:808 - info: [debug] [ADB] 1 device(s) connected
2017-03-24 11:25:00:809 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","ime","set","com.example.android.softkeyboard/.SoftKeyboard"]
2017-03-24 11:25:03:098 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:25:03:140 - info: [debug] [ADB] 1 device(s) connected
2017-03-24 11:25:03:144 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","am","force-stop","com.zhihu.android"]
2017-03-24 11:25:05:091 - info: [debug] [ADB] Pressing the HOME button
2017-03-24 11:25:05:092 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:25:05:129 - info: [debug] [ADB] 1 device(s) connected

//按home鍵回到桌面,應用退到後臺執行
// adb shell input keyevent 3
2017-03-24 11:25:05:131 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","input","keyevent",3]
2017-03-24 11:25:06:349 - info: [debug] [AndroidBootstrap] Sending command to android: {"cmd":"shutdown"}
2017-03-24 11:25:06:355 - info: [debug] [AndroidBootstrap] Received command result from bootstrap
2017-03-24 11:25:06:356 - info: [debug] [UiAutomator] Shutting down UiAutomator
2017-03-24 11:25:06:357 - info: [debug] [UiAutomator] Moving to state 'stopping'
2017-03-24 11:25:06:360 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"shutdown"}
2017-03-24 11:25:06:361 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type SHUTDOWN
2017-03-24 11:25:06:362 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":"OK, shutting down","status":0}
2017-03-24 11:25:06:362 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Closed client connection
2017-03-24 11:25:06:363 - info: [debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: numtests=1


2017-03-24 11:25:06:364 - info: [debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=.


2017-03-24 11:25:06:366 - info: [debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner


2017-03-24 11:25:06:367 - info: [debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: test=testRunServer


2017-03-24 11:25:06:367 - info: [debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: class="io".appium.android.bootstrap.Bootstrap


2017-03-24 11:25:06:368 - info: [debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: current=1


2017-03-24 11:25:06:369 - info: [debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: 0


2017-03-24 11:25:06:370 - info: [debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=


2017-03-24 11:25:06:371 - info: [debug] [AndroidBootstrap] [UIAUTO STDOUT] Test results for WatcherResultPrinter=.


2017-03-24 11:25:06:372 - info: [debug] [AndroidBootstrap] [UIAUTO STDOUT] Time: 50.273


2017-03-24 11:25:06:372 - info: [debug] [AndroidBootstrap] [UIAUTO STDOUT] OK (1 test)


2017-03-24 11:25:06:374 - info: [debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: -1

//關閉uiautomator
2017-03-24 11:25:06:376 - info: [debug] [UiAutomator] UiAutomator shut down normally
2017-03-24 11:25:06:376 - info: [debug] [UiAutomator] Moving to state 'stopped'
//殺掉所有的uiautomator程式
2017-03-24 11:25:06:377 - info: [debug] [ADB] Attempting to kill all uiautomator processes
2017-03-24 11:25:06:378 - info: [debug] [ADB] Getting all processes with uiautomator
2017-03-24 11:25:06:380 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:25:06:418 - info: [debug] [ADB] 1 device(s) connected
2017-03-24 11:25:06:422 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","ps"]
2017-03-24 11:25:06:489 - info: [ADB] No uiautomator process found to kill, continuing...
2017-03-24 11:25:06:489 - info: [debug] [UiAutomator] Moving to state 'stopped'
2017-03-24 11:25:06:490 - info: [debug] [ADB] Getting connected devices...
2017-03-24 11:25:06:524 - info: [debug] [ADB] 1 device(s) connected
2017-03-24 11:25:06:525 - info: [debug] [ADB] Running 'D:\android-sdk_r24.4.1-windows\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-

s","127.0.0.1:62001","shell","am","force-stop","io.appium.unlock"]
2017-03-24 11:25:07:716 - info: [debug] [Logcat] Stopping logcat capture
2017-03-24 11:25:07:722 - info: [debug] [AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` capability if wanted.
2017-03-24 11:25:07:724 - info: [Appium] Removing session bbdf133b-9332-4b26-9556-6249f006d3a0 from our master session list
2017-03-24 11:25:07:726 - info: [debug] [MJSONWP] Received response: null
2017-03-24 11:25:07:727 - info: [debug] [MJSONWP] But deleting session, so not returning
2017-03-24 11:25:07:727 - info: [debug] [MJSONWP] Responding to client with driver.deleteSession() result: null
2017-03-24 11:25:07:730 - info: [HTTP] <-- DELETE /wd/hub/session/bbdf133b-9332-4b26-9556-6249f006d3a0 200 6971 ms - 76
2017-03-24 11:28:53:457 - info: [Appium] Received SIGINT - shutting down

相關文章