appium本身是一个java项目,我们使用maven来管理appium需要引入的jar包
appium服务端环境搭建
- jdk环境
- Android SDK环境,设置ANDROID_HOME环境变量,加入path。
- Node.js环境: https://nodejs.org/en/download/
- 安装appium: http://appium.io/,加入path
appium客户端环境搭建
第一步:在eclipse中创建一个maven工程
eclipse中创建的maven工程默认jre system library版本是1.5的,将其更新为1.8。
第二步:在pom.xml中添加依赖jar包
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.appium.test</groupId>
<artifactId>appiumtest</artifactId>
<version>V1.0</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.6.0</version>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>5.0.4</version>
</dependency>
</dependencies>
</project>
其中通过访问http://mvnrepository.com/网站来寻找依赖包。
appium客户端驱动代码
package com.appium.driver;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
public class InitDriver {
public static void initDriver() throws MalformedURLException{
// 注意此apk是存在于服务端机器上的
File app = new File("apps/zhihu.apk");
// caps中存入的是k-v
DesiredCapabilities caps = new DesiredCapabilities();
// deviceName 这个参数可以随便写,但是不能没有这个参数
caps.setCapability("deviceName", "moniqi");
caps.setCapability("app", app.getAbsolutePath());
//使用appium的输入法,支持中文并隐藏键盘
caps.setCapability("unicodeKeyboard", true);
// 将输入法重置回设备默认的输入法
caps.setCapability("resetKeyboard", true);
// 不重签名app
caps.setCapability("noSign", true);
// 设置driver超时时间
caps.setCapability("newCommandTimeout", 120);
AndroidDriver<AndroidElement> driver = new AndroidDriver<AndroidElement>(
new URL("http://127.0.0.1:4723/wd/hub"),caps);
/** 代码脚本和服务端是通过 http://127.0.0.1:4723/wd/hub 来进行通信的
* 这就是服务端的接口地址。在4723端口监听服务器传送到服务器的命令。其中wd可以解释为web driver的简写
* */
/**
* AndroidDriver和AndroidElement的关系
* AndroidDriver继承WebDriver
* AndroidElement继承WebElement,表示一个Android元素
**/
}
public static void main(String[] args) {
try {
InitDriver.initDriver();
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
}
appium关键字讲解
appium关键字信息是存入到DesiredCapabilities类中的。
DesiredCapabilities caps = new DesiredCapabilities();
- deviceName
# 必须项,但在Android上它的值可以随便写
caps.setCapability("deviceName", "moniqi");
- app
# 要安装app路径,路径必须是在服务端所在电脑上存放的apk路径
caps.setCapability("app", new File("apps/zhihu.apk").getAbsolutePath());
- appPackage/appActivity
与app属性冲突
# 直接启动手机上已有的app,无需重新安装。需要注释掉app
caps.setCapability("appPackage", "包名");
caps.setCapability("appActivity", "起始activity");
- browserName
与appPackage、appActivity、app属性冲突
# 如果做手机web自动化,配置browserName属性,同时注释掉app、appPackage、appActivity
caps.setCapability("browserName", "Browser");
- appWaitActivity
appium如何判断自己把应用启动成功了?答:通过当前activity与起始activity对比。但是有的app的起始activity是一闪而过的。
# 指定开启应用时需要等待的activity名称
caps.setCapability("appWaitActivity", "activity名称");
- deviceReadyTimeout
appium是如何判断设备是正常响应的?答:执行adb shell "echo 'ready' 。默认5s内执行成功表明设备正常响应。
# 修改appium判断设备正常响应的超时时间
caps.setCapability("deviceReadyTimeout", 20);
- udid
适用场景是有多台设备连接时需要指定用哪一台设备进行测试。
# 表示指定连接某台设备。
caps.setCapability("udid", "127.0.0.1:62001");
- unicodeKeyboard/resetKeyboard
测试脚本输入时需要输入中文
# 使用appium的输入法,支持中文并隐藏键盘
caps.setCapability("unicodeKeyboard", true);
# 将输入法重置回设备默认的输入法
caps.setCapability("resetKeyboard", true);
- noSign
# 不重签名app
caps.setCapability("noSign", true);
- newCommandTimeout
默认60s内一直等待客户端发送脚本到服务端。超过默认时间服务端会认为客户端退出了。
# 修改默认时间为10分钟
caps.setCapability("newCommandTimeout", 600);
总结:以上10个参数为常用的caps参数。其中这10个参数又可分为两类。一类是与appium服务器相关的Capability,一类是Android测试专有参数
# 与appium服务器相关的Capability
deviceName
app
browserName
udid
newCommandTimeout
# Android测试专有参数
noSign
unicodeKeyboard/resetKeyboard
deviceReadyTimeout
appWaitActivity
appPackage/appActivity
由于caps的参数过多,为防止书写错误java中封装了两个表示常量的类。与appium服务器相关的Capability用 MobileCapabilityType 类封装。Android测试专有参数用 AndroidMobileCapabilityType 类封装
appium原理
appium可以分为三部分:appium客户端脚本、appium服务端、设备。其中appium服务端作为appium客户端脚本和手机设备进行通信的中转站。
appium客户端脚本和appium服务端直接的通信是通过http://127.0.0.1:4723/wd/hub完成的。
appium服务端和手机设备通信是通过appium服务端向手机设备发送一个BootStrap.jar(存放位置:/data/local/tmp)。来完成的。此jar包通过uiautomator启动(安卓设备<4.2是通过selendriod启动),创建一个socket服务,并监听4724端口。
appium服务端启动日志分析
> Checking if an update is available
> Update not available
> Launching Appium server with command: D:\appium\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 4723 --platform-name Android --platform-version 23 --automation-name Appium --log-no-color
> info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)
> info: Appium REST http interface listener started on 127.0.0.1:4723
> info: [debug] Non-default server args: {"address":"127.0.0.1","logNoColors":true,"platformName":"Android","platformVersion":"23","automationName":"Appium"}
> info: Console LogLevel: debug
// caps
> info: --> POST /wd/hub/session {"desiredCapabilities":{"app":"D:\\eclipse\\workspace0122\\appiumtest\\apps\\zhihu.apk","platformName":"Android","deviceName":"moniqi"},"requiredCapabilities":{},"capabilities":{"desiredCapabilities":{"app":"D:\\eclipse\\workspace0122\\appiumtest\\apps\\zhihu.apk","platformName":"Android","deviceName":"moniqi"},"requiredCapabilities":{},"alwaysMatch":{"platformName":"Android"},"firstMatch":[]}}
> info: Client User-Agent string: Apache-HttpClient/4.5.3 (Java/1.8.0_121)
// caps中没有写appActivity和appPackage
> info: [debug] No appActivity desired capability or server param. Parsing from apk.
> info: [debug] No appPackage desired capability or server param. Parsing from apk.
// 从apk包中去主动去解析
> info: [debug] Using local app from desired caps: D:\eclipse\workspace0122\appiumtest\apps\zhihu.apk
// 创建一个appium的session。得到session ID
> info: [debug] Creating new appium session 41fee12e-7fc7-4adc-b6e1-0ce1ea3e1a87
> info: Starting android appium
> info: [debug] Getting Java version
> info: Java version is: 1.8.0_121
// 做adb检查、依据我们环境变量的配置
> info: [debug] Checking whether adb is present
> info: [debug] Using adb from D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe
> info: [debug] Parsing package and activity from app manifest
> info: [debug] Checking whether aapt is present
// 通过aapt dump badging zhihu.apk 获取包或起始activity
> info: [debug] Using aapt from D:\android_workspace\AppData\Local\Android\sdk\build-tools\25.0.2\aapt.exe
> info: [debug] Extracting package and launch activity from manifest.
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\build-tools\25.0.2\aapt.exe dump badging D:\eclipse\workspace0122\appiumtest\apps\zhihu.apk
> info: [debug] badging package: com.zhihu.android
> info: [debug] badging act: com.zhihu.android.app.ui.activity.MainActivity
> info: [debug] Parsed package and activity are: com.zhihu.android/com.zhihu.android.app.ui.activity.MainActivity
// 进行快速重置
> info: [debug] Using fast reset? true
> info: [debug] Preparing device for session
> info: [debug] Checking whether app is actually present
> info: Retrieving device
> info: [debug] Trying to find a connected android device
> info: [debug] Getting connected devices...
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe devices
> info: [debug] 1 device(s) connected
> info: Found device 127.0.0.1:62001
// 找到设备并设置为我要操作的设备
> info: [debug] Setting device id to 127.0.0.1:62001
// 确定找到的设备是否能正常相应。执行一个shell命令来测试设备是否正常连接,超时时间为5s
> info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe -s 127.0.0.1:62001 wait-for-device
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe -s 127.0.0.1:62001 shell "echo 'ready'"
// 进行日志捕获
> info: [debug] Starting logcat capture
> info: [debug] Getting device API level
// 获取手机中Android版本
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe -s 127.0.0.1:62001 shell "getprop ro.build.version.sdk"
> info: [debug] Device is at API Level 19
> info: Device API level is: 19
> info: [debug] Extracting strings for language: default
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe -s 127.0.0.1:62001 shell "getprop persist.sys.language"
> info: [debug] Current device persist.sys.language: zh
> info: [debug] java -jar "D:\appium\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "D:\eclipse\workspace0122\appiumtest\apps\zhihu.apk" "C:\Users\ADMINI~1\AppData\Local\Temp\com.zhihu.android" zh
> info: [debug] Reading strings from converted strings.json
> info: [debug] Setting language to default
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe -s 127.0.0.1:62001 push "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\com.zhihu.android\\strings.json" /data/local/tmp
> info: [debug] Checking whether aapt is present
> info: [debug] Using aapt from D:\android_workspace\AppData\Local\Android\sdk\build-tools\25.0.2\aapt.exe
> info: [debug] Retrieving process from manifest.
// 解析 apk中AndroidManifest.xml文件
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\build-tools\25.0.2\aapt.exe dump xmltree D:\eclipse\workspace0122\appiumtest\apps\zhihu.apk AndroidManifest.xml
> info: [debug] Set app process to: com.zhihu.android
> info: [debug] Not uninstalling app since server not started with --full-reset
> info: [debug] Checking app cert for D:\eclipse\workspace0122\appiumtest\apps\zhihu.apk.
> info: [debug] executing cmd: java -jar D:\appium\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar D:\eclipse\workspace0122\appiumtest\apps\zhihu.apk
> info: [debug] App already signed.
> info: [debug] Zip-aligning D:\eclipse\workspace0122\appiumtest\apps\zhihu.apk
> info: [debug] Checking whether zipalign is present
> info: [debug] Using zipalign from D:\android_workspace\AppData\Local\Android\sdk\build-tools\25.0.2\zipalign.exe
> info: [debug] Zip-aligning apk.
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\build-tools\25.0.2\zipalign.exe -f 4 D:\eclipse\workspace0122\appiumtest\apps\zhihu.apk C:\Users\ADMINI~1\AppData\Local\Temp\118022-4144-x4cion\appium.tmp
// 发送到Android手机的上apk形式为:d9f8dd6bb601598747a44d89e7c628c7.apk
> info: [debug] MD5 for app is d9f8dd6bb601598747a44d89e7c628c7
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe -s 127.0.0.1:62001 shell "ls /data/local/tmp/d9f8dd6bb601598747a44d89e7c628c7.apk"
> info: [debug] Getting install status for com.zhihu.android
> info: [debug] Getting device API level
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe -s 127.0.0.1:62001 shell "getprop ro.build.version.sdk"
> info: [debug] Device is at API Level 19
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe -s 127.0.0.1:62001 shell "pm list packages -3 com.zhihu.android"
> info: [debug] App is installed
> info: App is already installed, resetting app
> info: [debug] Running fast reset (stop and clear)
// 判断app是否已经安装
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe -s 127.0.0.1:62001 shell "am force-stop com.zhihu.android"
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe -s 127.0.0.1:62001 shell "pm clear com.zhihu.android"
// 电脑上的4724端口和设备的4724进行关联,为后续进行通信
> info: [debug] Forwarding system:4724 to device:4724
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe -s 127.0.0.1:62001 forward tcp:4724 tcp:4724
// 将 bootstrap.jar包发送给设备,让设备通过这个jar包来接收服务端传递的信息
> info: [debug] Pushing appium bootstrap to device...
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe -s 127.0.0.1:62001 push "D:\\appium\\Appium\\node_modules\\appium\\build\\android_bootstrap\\AppiumBootstrap.jar" /data/local/tmp/
> info: [debug] Pushing settings apk to device...
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe -s 127.0.0.1:62001 install "D:\appium\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk"
> info: [debug] Pushing unlock helper app to device...
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe -s 127.0.0.1:62001 install "D:\appium\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
> info: Starting App
> info: [debug] Attempting to kill all 'uiautomator' processes
> info: [debug] Getting all processes with 'uiautomator'
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe -s 127.0.0.1:62001 shell "ps 'uiautomator'"
> info: [debug] No matching processes found
> info: [debug] Running bootstrap
// bootstrap.jar通过uiautomator被启动
> info: [debug] spawning: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe -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
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
> info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
// 开通了4724服务,并加载json
> info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
> info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
> info: [debug] [BOOTSTRAP] [debug] Loading json...
> info: [debug] [BOOTSTRAP] [debug] json loading complete.
> info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
> info: [debug] Waking up device if it's not alive
> info: [debug] Pushing command to appium work queue: ["wake",{}]
> info: [debug] [BOOTSTRAP] [debug] Client connected
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"wake","params":{}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: wake
// 获取当前界面的activity
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe -s 127.0.0.1:62001 shell "dumpsys window"
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}
> info: [debug] Screen already unlocked, continuing.
> info: [debug] Pushing command to appium work queue: ["getDataDir",{}]
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDataDir","params":{}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"\/data","status":0}
> info: [debug] dataDir set to: /data
> info: [debug] Pushing command to appium work queue: ["compressedLayoutHierarchy",{"compressLayout":false}]
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"compressedLayoutHierarchy","params":{"compressLayout":false}}
> info: [debug] Getting device API level
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe -s 127.0.0.1:62001 shell "getprop ro.build.version.sdk"
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":false,"status":0}
> info: [debug] Device is at API Level 19
// 启动app应用
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe -s 127.0.0.1:62001 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.zhihu.android/com.zhihu.android.app.ui.activity.MainActivity"
> info: [debug] Waiting for pkg "com.zhihu.android" and activity "com.zhihu.android.app.ui.activity.MainActivity" to be focused
> info: [debug] Getting focused package and activity
// 获取当前的activity和起始activity进行对比,判断是否一直
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe -s 127.0.0.1:62001 shell "dumpsys window windows"
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe -s 127.0.0.1:62001 shell "getprop ro.build.version.release"
> info: [debug] Device is at release version 4.4.2
> info: [debug] Device launched! Ready for commands
> info: [debug] Setting command timeout to the default of 60 secs
> info: [debug] Appium session started with sessionId 41fee12e-7fc7-4adc-b6e1-0ce1ea3e1a87
> info: <-- POST /wd/hub/session 303 10391.397 ms - 74
> info: --> GET /wd/hub/session/41fee12e-7fc7-4adc-b6e1-0ce1ea3e1a87 {}
> info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"4.4.2","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"D:\\eclipse\\workspace0122\\appiumtest\\apps\\zhihu.apk","platformName":"Android","deviceName":"moniqi"},"app":"D:\\eclipse\\workspace0122\\appiumtest\\apps\\zhihu.apk","platformName":"Android","deviceName":"127.0.0.1:62001"},"sessionId":"41fee12e-7fc7-4adc-b6e1-0ce1ea3e1a87"}
> info: <-- GET /wd/hub/session/41fee12e-7fc7-4adc-b6e1-0ce1ea3e1a87 200 4.124 ms - 560 {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"4.4.2","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"D:\\eclipse\\workspace0122\\appiumtest\\apps\\zhihu.apk","platformName":"Android","deviceName":"moniqi"},"app":"D:\\eclipse\\workspace0122\\appiumtest\\apps\\zhihu.apk","platformName":"Android","deviceName":"127.0.0.1:62001"},"sessionId":"41fee12e-7fc7-4adc-b6e1-0ce1ea3e1a87"}
> info: [debug] Didn't get a new command in 60 secs, shutting down...
> info: Shutting down appium session
> info: [debug] Pressing the HOME button
// 退出appium后,按一个home键
> info: [debug] executing cmd: D:\android_workspace\AppData\Local\Android\sdk\platform-tools\adb.exe -s 127.0.0.1:62001 shell "input keyevent 3"
> info: [debug] Stopping logcat capture
> info: [debug] Logcat terminated with code null, signal SIGTERM
> info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"shutdown"}
> info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"OK, shutting down","status":0}
> info: [debug] [BOOTSTRAP] [debug] Closed client connection
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
> info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
> info: [debug] [UIAUTOMATOR STDOUT] Time: 62.145
> info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
> info: [debug] UiAutomator shut down normally
> info: [debug] Cleaning up android objects
> info: [debug] Cleaning up appium session
> info: [debug] We shut down because no new commands came in
重点学习日志中相关的adb命令