appium(java)——环境搭建

来源:互联网 发布:淘宝如何装修店铺教程 编辑:程序博客网 时间:2024/06/05 20:27

一、搭建Android开发环境
1、安装JDK,配置Java环境变量
JDK下载地址:
[http://www.oracle.com/technetwork/java/javase/downloads/index.html ]
 1.1、运行安装jdk-8u131-windows-x64.exe
 1.2、配置环境变量(右键我的电脑–属性–高级–环境变量,下同):
 
     新建变量名:JAVA_HOME
     变量值:D:\Program Files\Java\jdk1.8.0_111
     新建变量名:CLASSPATH
     变量值:.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;
     变量名:Path
     变量值:%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;

 验证配置是否成功:CMD控制台输入:java -verison,如果显示Java版本信息表示安装成功,如下即表示成功:
java -verison

2、下载安装android SDK
 2.1、翻墙下载地址
   https://developer.android.com/studio/index.html?hl=zh-cn#win-bundle
   没有翻墙能力的直接用迅雷下载下面链接
   https://dl.google.com/android/repository/tools_r25.2.3-windows.zip?hl=zh-cn
 2.2、下载完毕后解压到本地硬盘任意位置并配置环境变量:
   2.2.1、右键我的电脑–属性–高级–环境变量
   2.2.2、在系统变量域中新建ANDROID_HOME变量
   
     变量名:ANDROID_HOME
     变量值:H:\android\sdk
   
   2.2.3、选择“系统变量”中变量名为“Path”的环境变量,双击该变量
   
     变量名:path
     变量值:%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;

   完成上述步骤以后,为了能够让手机连接到PC端进行真机测试。还需要安装测试手机对应的驱动程序。根据手机型号提前下载相应的离线驱动并安装,之后将手机与PC通过usb线相连。在cmd中输入:adb devices,如果能够看到设备,则表示安装成功
adb devices

3、Eclipse配置:
 3.1、Eclipse的官网地址:http://www.eclipse.org/
建议直接下载Eclipse IDE for Java EE Developers 的压缩包解压即可
 3.2、配置SDK:
 Windows”>”Preferences”,选择sdk目录,并点击“Apply”


二、下载、安装Appium
1、安装Node.js,下载地址:[ http://www.nodejs.org/ ]
 配置环境变量:
 
     变量名:Path
     变量值:D:\Program Files\nodejs\;

CMD输入:node -v,如果安装成功,会输出如下版本信息:
node –v

2、安装.Net Framework
   Tips:Appium是用.net开发的,所以安装之前需要安装.net framework,否则安装过程中会报错,官网下载:http://www.microsoft.com/zh-cn/download/details.aspx?id=30653

3、离线安装Appium(在线安装有很多问题就不介绍了,自行百度)
Windows版本的Appium下载地址:
[ https://bitbucket.org/appium/appium.app/downloads/ ]
直接双击appium-installer.exe文件安装就好,桌面会生成一个appium的图标

4、配置环境变量:
 4.1、选择“系统变量”中变量名为“Path”的环境变量,双击该变量
 
     变量名:path
     变量值:D:\Program Files (x86)\Appium\node_modules.bin;

 4.2、Appium下载目录如下:
Appium目录
   选择AppiumForWindows版本安装,安装成功之后点击”Appium.exe”运行即可,运行界面如图:
Appium启动页面

 4.3、检查appium所需的环境是否OK(这步很重要) 进入Cmd命令行,输入appium-doctor ,出现以下提示,All Checks were successful ,说明环境成功。
   appium-doctor

三、使用Eclipse直接创建案例工程
 3.1创建工程
   3.1.1、打开Eclipse,【File】–>【New】–>【Project】
   3.1.2、选择【Java Project】–>【Next】
   3.1.3、输入工程名称Appium_demo,点击【Finish】
   3.1.4、右键点击工程 New-Folder,新建两个文件夹:apps和libs,目录结构如下:
Appium_demo
 3.2、导入测试的类库
   3.2.1、导入Selenum类库:http://docs.seleniumhq.org/download/
    A) selenium-server-standalone-2.44.0.jar
    B) selenium-java-2.44.0.zip
   3.2.2、导入Appium类库:
    A) java-client-1.2.1.jar
   3.2.3、右键点击工程空白处,选择【Build Path】–>【Configure Build Path】

 3.3、下载测试APK
   3.3.1、下载测试的文件ContactManager.apk:
https://github.com/appium/sample-code/tree/master/sample-code/apps/ContactManager
   3.3.2、将下载的apk放到项目的apps目录下

 3.4、建立package包和案例文件
   3.4.1、在src文件夹上右键单击,【New】–>【package】,
      输入包名:com.glen.demo,点击【Finish】
   3.4.2、在package下新建类:ContactsTest.java,如下:  

package com.glen.demo;import io.appium.java_client.AppiumDriver;import org.junit.After;import org.junit.Before;import org.junit.Test;import org.openqa.selenium.By;import org.openqa.selenium.WebElement;import org.openqa.selenium.remote.CapabilityType;import org.openqa.selenium.remote.DesiredCapabilities; import java.io.File;  import java.net.URL;  import java.util.List;public class ContactsTest {    private AppiumDriver driver;     @Before    public void setUp() throws Exception {        //设置apk的路径        File classpathRoot = new File(System.getProperty("user.dir"));        File appDir = new File(classpathRoot, "apps");        File app = new File(appDir, "ContactManager.apk");        //设置自动化相关参数        DesiredCapabilities capabilities = new DesiredCapabilities();        capabilities.setCapability(CapabilityType.BROWSER_NAME, "");        capabilities.setCapability("platformName", "Android");        capabilities.setCapability("deviceName", "Android Emulator");        //设置安卓系统版本        capabilities.setCapability("platformVersion", "4.3");        //设置apk路径        capabilities.setCapability("app", app.getAbsolutePath());         //设置app的主包名和主类名        capabilities.setCapability("appPackage", "com.example.android.contactmanager");        capabilities.setCapability("appActivity", ".ContactManager");        //初始化        driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);           }    @Test    public void addContact(){        WebElement el = driver.findElement(By.name("Add Contact"));        el.click();        List<WebElement> textFieldsList = driver.findElementsByClassName("android.widget.EditText");        textFieldsList.get(0).sendKeys("Some Name");        textFieldsList.get(2).sendKeys("Some@example.com");        driver.swipe(100, 500, 100, 100, 2);        driver.findElementByName("Save").click();    }        @After    public void tearDown() throws Exception {        driver.quit();    }}

8、启动Appium
 方法一:cmd输入:appium
 cmd输入:appium
 
 方法二:
  1、直接双击appium gui图标
  2、点击右上角的启动按钮,启动日志如下:
appium启动按钮
9、运行测试案例:
  9.1、在eclipse中,项目右键>【Run As】>【JUnit Test】,运行过程截图如下:
这里写图片描述
  9.2、运行日志: 

> Checking if an update is available> Update not available> Starting Node Server> warn: Appium support for versions of node < 0.12 has been deprecated and will be removed in a future version. Please upgrade!> info: Welcome to Appium v1.4.0 (REV 8f63e2f91ef7907aed8bda763f4e5ca08e86970a)> info: Appium REST http interface listener started on 127.0.0.1:4723> info: [debug] Non-default server args: {"app":"F:\\workspace\\AppiumDemo\\apps\\ContactManager.apk","address":"127.0.0.1","logNoColors":true,"deviceName":"test","platformName":"Android","platformVersion":"18","automationName":"Appium"}> info: Console LogLevel: debug> info: --> POST /wd/hub/session {"desiredCapabilities":{"app":"F:\\workspace\\Appium_demo\\apps\\ContactManager.apk","platformVersion":"4.3","deviceName":"Android Emulator","platformName":"Android","appActivity":".ContactManager","browserName":"","appPackage":"com.example.android.contactmanager"}}> info: Client User-Agent string: Apache-HttpClient/4.3.4 (java 1.5)> info: [debug] Using local app from desired caps: F:\workspace\Appium_demo\apps\ContactManager.apk> info: [debug] Creating new appium session 97fd4549-c40a-4e96-a60a-6ffb9ed7fd01> info: Starting android appium> info: [debug] Getting Java version> info: Java version is: 1.7.0_51> info: [debug] Checking whether adb is present> info: [debug] Using adb from D:\android-sdk\sdk\platform-tools\adb.exe> info: [debug] Set chromedriver binary as: D:\Program Files\Appium\node_modules\appium\build\chromedriver\windows\chromedriver.exe> 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-sdk\sdk\platform-tools\adb.exe devices> info: [debug] 1 device(s) connected> info: Found device emulator-5554> info: [debug] Setting device id to emulator-5554> info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)> info: [debug] executing cmd: D:\android-sdk\sdk\platform-tools\adb.exe -s emulator-5554 wait-for-device> info: [debug] executing cmd: D:\android-sdk\sdk\platform-tools\adb.exe -s emulator-5554 shell "echo 'ready'"> info: [debug] Starting logcat capture> info: [debug] Getting device API level> info: [debug] executing cmd: D:\android-sdk\sdk\platform-tools\adb.exe -s emulator-5554 shell "getprop ro.build.version.sdk"> info: [debug] Device is at API Level 18> info: Device API level is: 18> info: [debug] Extracting strings for language: default> info: [debug] executing cmd: D:\android-sdk\sdk\platform-tools\adb.exe -s emulator-5554 shell "getprop persist.sys.language"> info: [debug] Current device persist.sys.language: en> info: [debug] java -jar "D:\Program Files\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "F:\workspace\Appium_demo\apps\ContactManager.apk" "C:\Users\ADMINI~1\AppData\Local\Temp\com.example.android.contactmanager" en> info: [debug] No strings.xml for language 'en', getting default strings.xml> info: [debug] java -jar "D:\Program Files\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "F:\workspace\Appium_demo\apps\ContactManager.apk" "C:\Users\ADMINI~1\AppData\Local\Temp\com.example.android.contactmanager"> info: [debug] Reading strings from converted strings.json> info: [debug] Setting language to default> info: [debug] executing cmd: D:\android-sdk\sdk\platform-tools\adb.exe -s emulator-5554 push "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\com.example.android.contactmanager\\strings.json" /data/local/tmp> info: [debug] Checking whether aapt is present> info: [debug] Using aapt from D:\android-sdk\sdk\build-tools\android-4.3\aapt.exe> info: [debug] Retrieving process from manifest.> info: [debug] executing cmd: D:\android-sdk\sdk\build-tools\android-4.3\aapt.exe dump xmltree F:\workspace\Appium_demo\apps\ContactManager.apk AndroidManifest.xml> info: [debug] Set app process to: com.example.android.contactmanager> info: [debug] Not uninstalling app since server not started with --full-reset> info: [debug] Checking app cert for F:\workspace\Appium_demo\apps\ContactManager.apk.> info: [debug] executing cmd: java -jar "D:\Program Files\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar" F:\workspace\Appium_demo\apps\ContactManager.apk> info: [debug] App already signed.> info: [debug] Zip-aligning F:\workspace\Appium_demo\apps\ContactManager.apk> info: [debug] Checking whether zipalign is present> info: [debug] Using zipalign from D:\android-sdk\sdk\tools\zipalign.exe> info: [debug] Zip-aligning apk.> info: [debug] executing cmd: D:\android-sdk\sdk\tools\zipalign.exe -f 4 F:\workspace\Appium_demo\apps\ContactManager.apk C:\Users\ADMINI~1\AppData\Local\Temp\11572-12744-gdxu1q\appium.tmp> info: [debug] MD5 for app is b2d2916bb5388e1dc281ec3e71ef1234> info: [debug] executing cmd: D:\android-sdk\sdk\platform-tools\adb.exe -s emulator-5554 shell "ls /data/local/tmp/b2d2916bb5388e1dc281ec3e71ef1234.apk"> info: [debug] Getting install status for com.example.android.contactmanager> info: [debug] Getting device API level> info: [debug] executing cmd: D:\android-sdk\sdk\platform-tools\adb.exe -s emulator-5554 shell "getprop ro.build.version.sdk"> info: [debug] Device is at API Level 18> info: [debug] executing cmd: D:\android-sdk\sdk\platform-tools\adb.exe -s emulator-5554 shell "pm list packages -3 com.example.android.contactmanager"> info: [debug] App is installed> info: App is already installed, resetting app> info: [debug] Running fast reset (stop and clear)> info: [debug] executing cmd: D:\android-sdk\sdk\platform-tools\adb.exe -s emulator-5554 shell "am force-stop com.example.android.contactmanager"> info: [debug] executing cmd: D:\android-sdk\sdk\platform-tools\adb.exe -s emulator-5554 shell "pm clear com.example.android.contactmanager"> info: [debug] Forwarding system:4724 to device:4724> info: [debug] executing cmd: D:\android-sdk\sdk\platform-tools\adb.exe -s emulator-5554 forward tcp:4724 tcp:4724> info: [debug] Pushing appium bootstrap to device...> info: [debug] executing cmd: D:\android-sdk\sdk\platform-tools\adb.exe -s emulator-5554 push "D:\\Program Files\\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-sdk\sdk\platform-tools\adb.exe -s emulator-5554 install "D:\Program Files\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-sdk\sdk\platform-tools\adb.exe -s emulator-5554 install "D:\Program Files\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-sdk\sdk\platform-tools\adb.exe -s emulator-5554 shell "ps 'uiautomator'"> info: [debug] No matching processes found> info: [debug] Running bootstrap> info: [debug] spawning: D:\android-sdk\sdk\platform-tools\adb.exe -s emulator-5554 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.example.android.contactmanager -e disableAndroidWatchers false> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=> info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1> 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] Waking up device if it's not alive> info: [debug] Pushing command to appium work queue: ["wake",{}]> info: [debug] [BOOTSTRAP] [debug] json loading complete.> info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.> 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> info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}> info: [debug] executing cmd: D:\android-sdk\sdk\platform-tools\adb.exe -s emulator-5554 shell "dumpsys window"> 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] [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] Getting device API level> info: [debug] executing cmd: D:\android-sdk\sdk\platform-tools\adb.exe -s emulator-5554 shell "getprop ro.build.version.sdk"> info: [debug] Device is at API Level 18> info: [debug] executing cmd: D:\android-sdk\sdk\platform-tools\adb.exe -s emulator-5554 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.example.android.contactmanager/.ContactManager"> info: [debug] Waiting for pkg "com.example.android.contactmanager" and activity ".ContactManager" to be focused> info: [debug] Getting focused package and activity> info: [debug] executing cmd: D:\android-sdk\sdk\platform-tools\adb.exe -s emulator-5554 shell "dumpsys window windows"> info: [debug] Getting focused package and activity> info: [debug] executing cmd: D:\android-sdk\sdk\platform-tools\adb.exe -s emulator-5554 shell "dumpsys window windows"> info: [debug] executing cmd: D:\android-sdk\sdk\platform-tools\adb.exe -s emulator-5554 shell "getprop ro.build.version.release"> info: [debug] Device is at release version 4.3> 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 97fd4549-c40a-4e96-a60a-6ffb9ed7fd01> info: <-- POST /wd/hub/session 303 54844.194 ms - 74 > info: --> GET /wd/hub/session/97fd4549-c40a-4e96-a60a-6ffb9ed7fd01 {}> info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"","platformVersion":"4.3","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"F:\\workspace\\Appium_demo\\apps\\ContactManager.apk","platformVersion":"4.3","deviceName":"Android Emulator","platformName":"Android","appActivity":".ContactManager","browserName":"","appPackage":"com.example.android.contactmanager"},"app":"F:\\workspace\\Appium_demo\\apps\\ContactManager.apk","deviceName":"emulator-5554","platformName":"Android","appActivity":".ContactManager","appPackage":"com.example.android.contactmanager"},"sessionId":"97fd4549-c40a-4e96-a60a-6ffb9ed7fd01"}> info: <-- GET /wd/hub/session/97fd4549-c40a-4e96-a60a-6ffb9ed7fd01 200 10.271 ms - 758 {"status":0,"value":{"platform":"LINUX","browserName":"","platformVersion":"4.3","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"F:\\workspace\\Appium_demo\\apps\\ContactManager.apk","platformVersion":"4.3","deviceName":"Android Emulator","platformName":"Android","appActivity":".ContactManager","browserName":"","appPackage":"com.example.android.contactmanager"},"app":"F:\\workspace\\Appium_demo\\apps\\ContactManager.apk","deviceName":"emulator-5554","platformName":"Android","appActivity":".ContactManager","appPackage":"com.example.android.contactmanager"},"sessionId":"97fd4549-c40a-4e96-a60a-6ffb9ed7fd01"}> info: --> POST /wd/hub/session/97fd4549-c40a-4e96-a60a-6ffb9ed7fd01/element {"using":"name","value":"Add Contact"}> warn: [DEPRECATED] The name locator strategy has been deprecated and will be removed.  Please use the accessibility id locator strategy instead.> info: [debug] Waiting up to 0ms for condition> info: [debug] Pushing command to appium work queue: ["find",{"strategy":"name","selector":"Add Contact","context":"","multiple":false}]> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"name","selector":"Add Contact","context":"","multiple":false}}> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION> info: [debug] [BOOTSTRAP] [debug] Got command action: find> info: [debug] [BOOTSTRAP] [debug] Finding Add Contact using NAME with the contextId:  multiple: false> info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[DESCRIPTION=Add Contact, INSTANCE=0]> info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":{"ELEMENT":"1"},"status":0}> info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"1"},"sessionId":"97fd4549-c40a-4e96-a60a-6ffb9ed7fd01"}> info: <-- POST /wd/hub/session/97fd4549-c40a-4e96-a60a-6ffb9ed7fd01/element 200 5585.076 ms - 87 {"status":0,"value":{"ELEMENT":"1"},"sessionId":"97fd4549-c40a-4e96-a60a-6ffb9ed7fd01"}> info: --> POST /wd/hub/session/97fd4549-c40a-4e96-a60a-6ffb9ed7fd01/element/1/click {"id":"1"}> info: [debug] Pushing command to appium work queue: ["element:click",{"elementId":"1"}]> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"1"}}> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION> info: [debug] [BOOTSTRAP] [debug] Got command action: click> info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}> info: [debug] Responding to client with success: {"status":0,"value":true,"sessionId":"97fd4549-c40a-4e96-a60a-6ffb9ed7fd01"}> info: <-- POST /wd/hub/session/97fd4549-c40a-4e96-a60a-6ffb9ed7fd01/element/1/click 200 3611.421 ms - 76 {"status":0,"value":true,"sessionId":"97fd4549-c40a-4e96-a60a-6ffb9ed7fd01"}> info: --> POST /wd/hub/session/97fd4549-c40a-4e96-a60a-6ffb9ed7fd01/elements {"using":"class name","value":"android.widget.EditText"}> info: [debug] Waiting up to 0ms for condition> info: [debug] Pushing command to appium work queue: ["find",{"strategy":"class name","selector":"android.widget.EditText","context":"","multiple":true}]> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"class name","selector":"android.widget.EditText","context":"","multiple":true}}> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION> info: [debug] [BOOTSTRAP] [debug] Got command action: find> info: [debug] [BOOTSTRAP] [debug] Finding android.widget.EditText using CLASS_NAME with the contextId:  multiple: true> info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[CLASS=android.widget.EditText]> info: [debug] [BOOTSTRAP] [debug] getElements selector:UiSelector[CLASS=android.widget.EditText]> info: [debug] [BOOTSTRAP] [debug] Element[] is null: (0)> info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.EditText, INSTANCE=0]> info: [debug] [BOOTSTRAP] [debug] Failed to locate element. Clearing Accessibility cache and retrying.> info: [debug] [BOOTSTRAP] [debug] Finding android.widget.EditText using CLASS_NAME with the contextId:  multiple: true> info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[CLASS=android.widget.EditText]> info: [debug] [BOOTSTRAP] [debug] getElements selector:UiSelector[CLASS=android.widget.EditText]> info: [debug] [BOOTSTRAP] [debug] Element[] is null: (0)> info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.EditText, INSTANCE=0]> info: [debug] [BOOTSTRAP] [debug] Element[] is null: (1)> info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.EditText, INSTANCE=1]> info: [debug] [BOOTSTRAP] [debug] Element[] is null: (2)> info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.EditText, INSTANCE=2]> info: [debug] [BOOTSTRAP] [debug] Element[] is null: (3)> info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.EditText, INSTANCE=3]> info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":[{"ELEMENT":"2"},{"ELEMENT":"3"},{"ELEMENT":"4"}],"status":0}> info: [debug] Responding to client with success: {"status":0,"value":[{"ELEMENT":"2"},{"ELEMENT":"3"},{"ELEMENT":"4"}],"sessionId":"97fd4549-c40a-4e96-a60a-6ffb9ed7fd01"}> info: <-- POST /wd/hub/session/97fd4549-c40a-4e96-a60a-6ffb9ed7fd01/elements 200 7287.293 ms - 121 {"status":0,"value":[{"ELEMENT":"2"},{"ELEMENT":"3"},{"ELEMENT":"4"}],"sessionId":"97fd4549-c40a-4e96-a60a-6ffb9ed7fd01"}> info: --> POST /wd/hub/session/97fd4549-c40a-4e96-a60a-6ffb9ed7fd01/element/2/value {"id":"2","value":["Some Name"]}> info: [debug] Pushing command to appium work queue: ["element:setText",{"elementId":"2","text":"Some Name","replace":false}]> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:setText","params":{"elementId":"2","text":"Some Name","replace":false}}> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION> info: [debug] [BOOTSTRAP] [debug] Got command action: setText> info: [debug] [BOOTSTRAP] [debug] Using element passed in.> info: [debug] [BOOTSTRAP] [debug] Attempting to clear using UiObject.clearText().> info: [debug] [BOOTSTRAP] [debug] Sending plain text to element: Some Name> info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}> info: [debug] Responding to client with success: {"status":0,"value":true,"sessionId":"97fd4549-c40a-4e96-a60a-6ffb9ed7fd01"}> info: <-- POST /wd/hub/session/97fd4549-c40a-4e96-a60a-6ffb9ed7fd01/element/2/value 200 16926.651 ms - 76 {"status":0,"value":true,"sessionId":"97fd4549-c40a-4e96-a60a-6ffb9ed7fd01"}> info: --> POST /wd/hub/session/97fd4549-c40a-4e96-a60a-6ffb9ed7fd01/element/4/value {"id":"4","value":["Some@example.com"]}> info: [debug] Pushing command to appium work queue: ["element:setText",{"elementId":"4","text":"Some@example.com","replace":false}]> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:setText","params":{"elementId":"4","text":"Some@example.com","replace":false}}> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION> info: [debug] [BOOTSTRAP] [debug] Got command action: setText> info: [debug] [BOOTSTRAP] [debug] Using element passed in.> info: [debug] [BOOTSTRAP] [debug] Attempting to clear using UiObject.clearText().> info: [debug] [BOOTSTRAP] [debug] Sending plain text to element: Some@example.com> info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}> info: [debug] Responding to client with success: {"status":0,"value":true,"sessionId":"97fd4549-c40a-4e96-a60a-6ffb9ed7fd01"}> info: <-- POST /wd/hub/session/97fd4549-c40a-4e96-a60a-6ffb9ed7fd01/element/4/value 200 21149.764 ms - 76 {"status":0,"value":true,"sessionId":"97fd4549-c40a-4e96-a60a-6ffb9ed7fd01"}> info: --> POST /wd/hub/session/97fd4549-c40a-4e96-a60a-6ffb9ed7fd01/touch/perform {"actions":[{"action":"press","options":{"x":100,"y":500}},{"action":"wait","options":{"ms":2}},{"action":"moveTo","options":{"x":100,"y":100}},{"action":"release","options":{}}]}> info: [debug] Pushing command to appium work queue: ["swipe",{"startX":100,"startY":500,"endX":100,"endY":100,"steps":0}]> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"swipe","params":{"startX":100,"startY":500,"endX":100,"endY":100,"steps":0}}> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION> info: [debug] [BOOTSTRAP] [debug] Got command action: swipe> info: [debug] [BOOTSTRAP] [debug] Display bounds: [0,0][480,800]> info: [debug] [BOOTSTRAP] [debug] Display bounds: [0,0][480,800]> info: [debug] [BOOTSTRAP] [debug] Swiping from [x=100.0, y=500.0] to [x=100.0, y=100.0] with steps: 0> info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}> info: [debug] Responding to client with success: {"status":0,"value":true,"sessionId":"97fd4549-c40a-4e96-a60a-6ffb9ed7fd01"}> info: <-- POST /wd/hub/session/97fd4549-c40a-4e96-a60a-6ffb9ed7fd01/touch/perform 200 903.431 ms - 76 {"status":0,"value":true,"sessionId":"97fd4549-c40a-4e96-a60a-6ffb9ed7fd01"}> info: --> POST /wd/hub/session/97fd4549-c40a-4e96-a60a-6ffb9ed7fd01/element {"using":"name","value":"Save"}> info: [debug] Waiting up to 0ms for condition> info: [debug] Pushing command to appium work queue: ["find",{"strategy":"name","selector":"Save","context":"","multiple":false}]> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"name","selector":"Save","context":"","multiple":false}}> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION> info: [debug] [BOOTSTRAP] [debug] Got command action: find> info: [debug] [BOOTSTRAP] [debug] Finding Save using NAME with the contextId:  multiple: false> info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[DESCRIPTION=Save, INSTANCE=0]> info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[TEXT=Save, INSTANCE=0]> info: [debug] [BOOTSTRAP] [debug] Failed to locate element. Clearing Accessibility cache and retrying.> info: [debug] [BOOTSTRAP] [debug] Finding Save using NAME with the contextId:  multiple: false> info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[DESCRIPTION=Save, INSTANCE=0]> info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[TEXT=Save, INSTANCE=0]> info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"No element found","status":7}> info: [debug] Condition unmet after 7910ms. Timing out.> info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"No element found"},"sessionId":"97fd4549-c40a-4e96-a60a-6ffb9ed7fd01"}> info: <-- POST /wd/hub/session/97fd4549-c40a-4e96-a60a-6ffb9ed7fd01/element 500 7913.313 ms - 195 > info: --> DELETE /wd/hub/session/97fd4549-c40a-4e96-a60a-6ffb9ed7fd01 {}> info: Shutting down appium session> info: [debug] Pressing the HOME button> info: [debug] executing cmd: D:\android-sdk\sdk\platform-tools\adb.exe -s emulator-5554 shell "input keyevent 3"> info: [debug] Stopping logcat capture> info: [debug] Logcat terminated with code null, signal SIGTERM> 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] Sent shutdown command, waiting for UiAutomator to stop...> info: [debug] [BOOTSTRAP] [debug] Closed client connection> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer> 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: 89.301> 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] Responding to client with success: {"status":0,"value":null,"sessionId":"97fd4549-c40a-4e96-a60a-6ffb9ed7fd01"}> info: <-- DELETE /wd/hub/session/97fd4549-c40a-4e96-a60a-6ffb9ed7fd01 200 8799.959 ms - 76 {"status":0,"value":null,"sessionId":"97fd4549-c40a-4e96-a60a-6ffb9ed7fd01"}

所需资源,实在找不到可以去我的网盘下载
链接:http://pan.baidu.com/s/1nuHFdwd 密码:smh1