Appium学习(四)--原理、日志介绍

appium原理:

appium设计采用C/S模式,支持多种语言,基于webdriver协议,webdriver是基于http协议的,支持Android和ios的APP自动化同时也支持firefox的web自动化。appium通过中间件bootstrap.js驱动UiAutomation和UiAutomator去实现app自动化。对于android来说,4.2以后是基于uiautomator框架实现查找注入事件的,4.2以前则是instrumentation框架的,并封装成一个叫Selendroid提供服务 。对于ios来说,是使用uiautomation框架。

appium启动时会自动创建一个http://127.0.0.1:4723/wd/hub服务端,脚本通过http://127.0.0.1:4723/wd/hub连接会告诉服务器要做什么,服务端启动一个4724的端口去跟设备通信,在设备上执行脚本时,服务端会先向设备上发一个bootstrap.js或者bootstrap.jar,会启动这个包,启动后会创建一个sockte服务,bootstrap.jar包会驱动UiAutomation或者UiAutomator底层框架去设备上完成具体的命令操作,完成任务后,通过socket服务向服务端反馈响应,服务端再通过4723端口给脚本反馈响应,这样一条命令语句就完成了。

appium日志:

下面介绍appium日志的大概分析
转载自:[https://blog.csdn.net/jffhy2017/article/details/69372064](https://blog.csdn.net/jffhy2017/article/details/69372064)
 
//启动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":["[email protected]"]}
2017-03-24 11:24:31:014 - info: [debug] [MJSONWP] Calling AppiumDriver.setValue() with args: [["[email protected]"],"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":"[email protected]","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":"[email protected]","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: [email protected]
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: " 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

你可能感兴趣的:(Appium学习(四)--原理、日志介绍)