Appium入门实例(Java)

xiaoxiao2021-02-28  98

一、使用Eclipse直接创建案例工程 1、打开Eclipse,【File】–>【New】–>【Project】 2、选择【Java Project】–>【Next】 3、输入工程名称Appium_demo,点击【Finish】 4、右键点击工程 New-Folder,新建两个文件夹:apps和libs,与src目录同级

二、导入测试的类库 1、Selenum类库:http://docs.seleniumhq.org/download/     1) selenium-server-standalone-2.44.0.jar     2) selenium-java-2.44.0.zip 2、Appium类库:     1) java-client-1.2.1.jar   将以上下载好的jar包放在lib目录下。 3、右键点击工程空白处,选择【Build Path】–>【Configure Build Path】,点击ADD JARs…,讲lib下的jar包添加进去。

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

四、建立package包和案例文件   1、在src文件夹上右键单击,【New】–>【package】,输入包名:com.dan.demo,点击【Finish】   2、在package下新建类:ContactsTest.java,如下:     下载地址:https://github.com/appium/sample-code/tree/master/sample-code/examples/java/junit/src/test/java/com/saucelabs/appium

五、源码如下

package com.dan.demo; import io.appium.java_client.AppiumDriver; import io.appium.java_client.TouchAction; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidElement; import java.io.File; import java.net.URL; import java.util.List; 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.DesiredCapabilities; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; public class ContactsTest { private AppiumDriver<WebElement> driver; @Before public void setUp() throws Exception { // set up appium File classpathRoot = new File(System.getProperty("user.dir")); File appDir = new File(classpathRoot, "/apps"); File app = new File(appDir, "GomeEShop.apk"); DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("noReset", true); //如果加该行代码则APP不需要再次安装 capabilities.setCapability("unicodeKeyboard","True");//support Chinese支持中文输入 capabilities.setCapability("deviceName", "4d1219502472216f"); capabilities.setCapability("platformVersion", "4.4"); capabilities.setCapability("app", app.getAbsolutePath()); capabilities.setCapability("appPackage", "com.gome.eshopnew"); capabilities.setCapability("appActivity", "com.gome.ecmall.home.LaunchActivity"); driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); System.out.println("App is launched!"); } @Test public void addContact() throws InterruptedException { //Thread.sleep(10000); new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(By.className("android.widget.RelativeLayout"))); WebElement el = driver.findElement(By.className("android.widget.RelativeLayout")); System.out.println(el); System.out.println("App is done!"); } @After public void tearDown() throws Exception { driver.quit(); } }

五、 启动Android模拟器(也可以连接真机)

1、cmd输入:android avd,选择模拟器,点击【Start】即可。具体可参考:http://www.cnblogs.com/puresoul/p/4597211.html 2、启动好后,cmd输入:adb devices,确定设备是否连接上。

六、 启动Appium 方法一:cmd输入:appium 方法二: 1、直接双击appium gui图标 2、点击右上角的启动按钮,启动日志如下:

Launching Appium server with command: D:\Program Files (x86)\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

七、 运行测试案例: 1、在eclipse中,项目右键>【Run As】>【JUnit Test】 App is launched! [[AndroidDriver: Android on LINUX (d3706f15-43ca-4f07-89a1-177a3f0a5af2)] -> class name: android.widget.RelativeLayout] App is done!

九、Appium运行结果:

Launching Appium server with command: D:\Program Files (x86)\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 info: –> POST /wd/hub/session {“capabilities”:[{“desiredCapabilities”:{“app”:”C:\Users\zhangxiaoding\workspace\TestGome\apps\GomeEShop.apk”,”appPackage”:”com.gome.eshopnew”,”appActivity”:”com.gome.ecmall.home.LaunchActivity”,”noReset”:true,”platformVersion”:”4.4”,”unicodeKeyboard”:”True”,”platformName”:”Android”,”deviceName”:”4d1219502472216f”}},{“requiredCapabilities”:{}}],”desiredCapabilities”:{“app”:”C:\Users\zhangxiaoding\workspace\TestGome\apps\GomeEShop.apk”,”appPackage”:”com.gome.eshopnew”,”appActivity”:”com.gome.ecmall.home.LaunchActivity”,”noReset”:true,”platformVersion”:”4.4”,”unicodeKeyboard”:”True”,”platformName”:”Android”,”deviceName”:”4d1219502472216f”},”requiredCapabilities”:{}} info: Client User-Agent string: Apache-HttpClient/4.5.2 (Java/1.8.0_66) warn: Converting cap unicodeKeyboard from string to boolean. This might cause unexpected behavior. info: [debug] Using local app from desired caps: C:\Users\zhangxiaoding\workspace\TestGome\apps\GomeEShop.apk info: [debug] Creating new appium session d3706f15-43ca-4f07-89a1-177a3f0a5af2 info: Starting android appium info: [debug] Getting Java version info: Java version is: 1.8.0_66 info: [debug] Checking whether adb is present info: [debug] Using adb from D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe info: [debug] Using fast reset? false 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:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe devices info: [debug] 1 device(s) connected info: Found device 127.0.0.1:21503 info: [debug] Setting device id to 127.0.0.1:21503 info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5) info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 wait-for-device info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 shell “echo ‘ready’” info: [debug] Starting logcat capture info: [debug] Getting device API level info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 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:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 shell “getprop persist.sys.language” info: [debug] Current device persist.sys.language: zh info: [debug] java -jar “D:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar” “stringsFromApk” “C:\Users\zhangxiaoding\workspace\TestGome\apps\GomeEShop.apk” “C:\Users\zhangxiaoding\AppData\Local\Temp\com.gome.eshopnew” zh info: [debug] Reading strings from converted strings.json info: [debug] Setting language to default info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 push “C:\Users\zhangxiaoding\AppData\Local\Temp\com.gome.eshopnew\strings.json” /data/local/tmp info: [debug] Checking whether aapt is present info: [debug] Using aapt from D:\adt-bundle-windows-x86-20130729\sdk\build-tools\android-4.3\aapt.exe info: [debug] Retrieving process from manifest. info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\build-tools\android-4.3\aapt.exe dump xmltree C:\Users\zhangxiaoding\workspace\TestGome\apps\GomeEShop.apk AndroidManifest.xml info: [debug] Set app process to: com.gome.eshopnew info: [debug] Not uninstalling app since server not started with –full-reset info: [debug] Checking app cert for C:\Users\zhangxiaoding\workspace\TestGome\apps\GomeEShop.apk. info: [debug] executing cmd: java -jar “D:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar” C:\Users\zhangxiaoding\workspace\TestGome\apps\GomeEShop.apk info: [debug] App already signed. info: [debug] Zip-aligning C:\Users\zhangxiaoding\workspace\TestGome\apps\GomeEShop.apk info: [debug] Checking whether zipalign is present info: [debug] Using zipalign from D:\adt-bundle-windows-x86-20130729\sdk\tools\zipalign.exe info: [debug] Zip-aligning apk. info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\tools\zipalign.exe -f 4 C:\Users\zhangxiaoding\workspace\TestGome\apps\GomeEShop.apk C:\Users\zhangxiaoding\AppData\Local\Temp\11781-4272-fcwlv\appium.tmp info: [debug] MD5 for app is bbf84e95bbe54549399d075a58f64b13 info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 shell “ls /data/local/tmp/bbf84e95bbe54549399d075a58f64b13.apk” info: [debug] Getting install status for com.gome.eshopnew info: [debug] Getting device API level info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 shell “getprop ro.build.version.sdk” info: [debug] Device is at API Level 19 info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 shell “pm list packages -3 com.gome.eshopnew” info: [debug] App is installed info: [debug] Forwarding system:4724 to device:4724 info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 forward tcp:4724 tcp:4724 info: [debug] Pushing appium bootstrap to device… info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 push “D:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar” /data/local/tmp/ info: [debug] Enabling Unicode keyboard support info: [debug] Pushing unicode ime to device… info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 install “D:\Program Files (x86)\Appium\node_modules\appium\build\unicode_ime_apk\UnicodeIME-debug.apk” info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 shell “settings get secure default_input_method” info: [debug] Unsetting IME ‘io.appium.android.ime/.UnicodeIME’ info: [debug] Setting IME to ‘io.appium.android.ime/.UnicodeIME’ info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 shell “ime enable io.appium.android.ime/.UnicodeIME” info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 shell “ime set io.appium.android.ime/.UnicodeIME” info: [debug] Pushing settings apk to device… info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 install “D:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk” info: [debug] Pushing unlock helper app to device… info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 install “D:\Program Files (x86)\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:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 shell “ps ‘uiautomator’” info: [debug] No matching processes found info: [debug] Running bootstrap info: [debug] spawning: D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.gome.eshopnew -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 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] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 shell “dumpsys window” 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] 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] Getting device API level info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 shell “getprop ro.build.version.sdk” info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:false,”status”:0} info: [debug] Device is at API Level 19 info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 shell “am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.gome.eshopnew/com.gome.ecmall.home.LaunchActivity” info: [debug] Waiting for pkg “com.gome.eshopnew” and activity “com.gome.ecmall.home.LaunchActivity” to be focused info: [debug] Getting focused package and activity info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 shell “dumpsys window windows” info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 shell “getprop ro.build.version.release” info: [debug] Device is at release version 4.4.4 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 d3706f15-43ca-4f07-89a1-177a3f0a5af2 info: <– POST /wd/hub/session 303 10396.832 ms - 74 info: –> GET /wd/hub/session/d3706f15-43ca-4f07-89a1-177a3f0a5af2 {} info: [debug] Responding to client with success: {“status”:0,”value”:{“platform”:”LINUX”,”browserName”:”Android”,”platformVersion”:”4.4.4”,”webStorageEnabled”:false,”takesScreenshot”:true,”javascriptEnabled”:true,”databaseEnabled”:false,”networkConnectionEnabled”:true,”locationContextEnabled”:false,”warnings”:{},”desired”:{“app”:”C:\Users\zhangxiaoding\workspace\TestGome\apps\GomeEShop.apk”,”appPackage”:”com.gome.eshopnew”,”appActivity”:”com.gome.ecmall.home.LaunchActivity”,”noReset”:true,”platformVersion”:”4.4”,”unicodeKeyboard”:true,”platformName”:”Android”,”deviceName”:”4d1219502472216f”},”app”:”C:\Users\zhangxiaoding\workspace\TestGome\apps\GomeEShop.apk”,”appPackage”:”com.gome.eshopnew”,”appActivity”:”com.gome.ecmall.home.LaunchActivity”,”noReset”:true,”unicodeKeyboard”:true,”platformName”:”Android”,”deviceName”:”127.0.0.1:21503”},”sessionId”:”d3706f15-43ca-4f07-89a1-177a3f0a5af2”} info: <– GET /wd/hub/session/d3706f15-43ca-4f07-89a1-177a3f0a5af2 200 3.520 ms - 862 {“status”:0,”value”:{“platform”:”LINUX”,”browserName”:”Android”,”platformVersion”:”4.4.4”,”webStorageEnabled”:false,”takesScreenshot”:true,”javascriptEnabled”:true,”databaseEnabled”:false,”networkConnectionEnabled”:true,”locationContextEnabled”:false,”warnings”:{},”desired”:{“app”:”C:\Users\zhangxiaoding\workspace\TestGome\apps\GomeEShop.apk”,”appPackage”:”com.gome.eshopnew”,”appActivity”:”com.gome.ecmall.home.LaunchActivity”,”noReset”:true,”platformVersion”:”4.4”,”unicodeKeyboard”:true,”platformName”:”Android”,”deviceName”:”4d1219502472216f”},”app”:”C:\Users\zhangxiaoding\workspace\TestGome\apps\GomeEShop.apk”,”appPackage”:”com.gome.eshopnew”,”appActivity”:”com.gome.ecmall.home.LaunchActivity”,”noReset”:true,”unicodeKeyboard”:true,”platformName”:”Android”,”deviceName”:”127.0.0.1:21503”},”sessionId”:”d3706f15-43ca-4f07-89a1-177a3f0a5af2”} info: –> GET /wd/hub/session/d3706f15-43ca-4f07-89a1-177a3f0a5af2 {} info: [debug] Responding to client with success: {“status”:0,”value”:{“platform”:”LINUX”,”browserName”:”Android”,”platformVersion”:”4.4.4”,”webStorageEnabled”:false,”takesScreenshot”:true,”javascriptEnabled”:true,”databaseEnabled”:false,”networkConnectionEnabled”:true,”locationContextEnabled”:false,”warnings”:{},”desired”:{“app”:”C:\Users\zhangxiaoding\workspace\TestGome\apps\GomeEShop.apk”,”appPackage”:”com.gome.eshopnew”,”appActivity”:”com.gome.ecmall.home.LaunchActivity”,”noReset”:true,”platformVersion”:”4.4”,”unicodeKeyboard”:true,”platformName”:”Android”,”deviceName”:”4d1219502472216f”},”app”:”C:\Users\zhangxiaoding\workspace\TestGome\apps\GomeEShop.apk”,”appPackage”:”com.gome.eshopnew”,”appActivity”:”com.gome.ecmall.home.LaunchActivity”,”noReset”:true,”unicodeKeyboard”:true,”platformName”:”Android”,”deviceName”:”127.0.0.1:21503”},”sessionId”:”d3706f15-43ca-4f07-89a1-177a3f0a5af2”} info: <– GET /wd/hub/session/d3706f15-43ca-4f07-89a1-177a3f0a5af2 200 6.754 ms - 862 {“status”:0,”value”:{“platform”:”LINUX”,”browserName”:”Android”,”platformVersion”:”4.4.4”,”webStorageEnabled”:false,”takesScreenshot”:true,”javascriptEnabled”:true,”databaseEnabled”:false,”networkConnectionEnabled”:true,”locationContextEnabled”:false,”warnings”:{},”desired”:{“app”:”C:\Users\zhangxiaoding\workspace\TestGome\apps\GomeEShop.apk”,”appPackage”:”com.gome.eshopnew”,”appActivity”:”com.gome.ecmall.home.LaunchActivity”,”noReset”:true,”platformVersion”:”4.4”,”unicodeKeyboard”:true,”platformName”:”Android”,”deviceName”:”4d1219502472216f”},”app”:”C:\Users\zhangxiaoding\workspace\TestGome\apps\GomeEShop.apk”,”appPackage”:”com.gome.eshopnew”,”appActivity”:”com.gome.ecmall.home.LaunchActivity”,”noReset”:true,”unicodeKeyboard”:true,”platformName”:”Android”,”deviceName”:”127.0.0.1:21503”},”sessionId”:”d3706f15-43ca-4f07-89a1-177a3f0a5af2”} info: –> GET /wd/hub/session/d3706f15-43ca-4f07-89a1-177a3f0a5af2 {} info: [debug] Responding to client with success: {“status”:0,”value”:{“platform”:”LINUX”,”browserName”:”Android”,”platformVersion”:”4.4.4”,”webStorageEnabled”:false,”takesScreenshot”:true,”javascriptEnabled”:true,”databaseEnabled”:false,”networkConnectionEnabled”:true,”locationContextEnabled”:false,”warnings”:{},”desired”:{“app”:”C:\Users\zhangxiaoding\workspace\TestGome\apps\GomeEShop.apk”,”appPackage”:”com.gome.eshopnew”,”appActivity”:”com.gome.ecmall.home.LaunchActivity”,”noReset”:true,”platformVersion”:”4.4”,”unicodeKeyboard”:true,”platformName”:”Android”,”deviceName”:”4d1219502472216f”},”app”:”C:\Users\zhangxiaoding\workspace\TestGome\apps\GomeEShop.apk”,”appPackage”:”com.gome.eshopnew”,”appActivity”:”com.gome.ecmall.home.LaunchActivity”,”noReset”:true,”unicodeKeyboard”:true,”platformName”:”Android”,”deviceName”:”127.0.0.1:21503”},”sessionId”:”d3706f15-43ca-4f07-89a1-177a3f0a5af2”} info: <– GET /wd/hub/session/d3706f15-43ca-4f07-89a1-177a3f0a5af2 200 0.934 ms - 862 {“status”:0,”value”:{“platform”:”LINUX”,”browserName”:”Android”,”platformVersion”:”4.4.4”,”webStorageEnabled”:false,”takesScreenshot”:true,”javascriptEnabled”:true,”databaseEnabled”:false,”networkConnectionEnabled”:true,”locationContextEnabled”:false,”warnings”:{},”desired”:{“app”:”C:\Users\zhangxiaoding\workspace\TestGome\apps\GomeEShop.apk”,”appPackage”:”com.gome.eshopnew”,”appActivity”:”com.gome.ecmall.home.LaunchActivity”,”noReset”:true,”platformVersion”:”4.4”,”unicodeKeyboard”:true,”platformName”:”Android”,”deviceName”:”4d1219502472216f”},”app”:”C:\Users\zhangxiaoding\workspace\TestGome\apps\GomeEShop.apk”,”appPackage”:”com.gome.eshopnew”,”appActivity”:”com.gome.ecmall.home.LaunchActivity”,”noReset”:true,”unicodeKeyboard”:true,”platformName”:”Android”,”deviceName”:”127.0.0.1:21503”},”sessionId”:”d3706f15-43ca-4f07-89a1-177a3f0a5af2”} info: –> POST /wd/hub/session/d3706f15-43ca-4f07-89a1-177a3f0a5af2/elements {“using”:”class name”,”value”:”android.widget.RelativeLayout”} info: [debug] Waiting up to 0ms for condition info: [debug] Pushing command to appium work queue: [“find”,{“strategy”:”class name”,”selector”:”android.widget.RelativeLayout”,”context”:”“,”multiple”:true}] info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:”action”,”action”:”find”,”params”:{“strategy”:”class name”,”selector”:”android.widget.RelativeLayout”,”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.RelativeLayout using CLASS_NAME with the contextId: multiple: true info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[CLASS=android.widget.RelativeLayout] info: [debug] [BOOTSTRAP] [debug] getElements selector:UiSelector[CLASS=android.widget.RelativeLayout] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (0) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=0] info: [debug] [BOOTSTRAP] [debug] Failed to locate element. Clearing Accessibility cache and retrying. info: [debug] [BOOTSTRAP] [debug] Finding android.widget.RelativeLayout using CLASS_NAME with the contextId: multiple: true info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[CLASS=android.widget.RelativeLayout] info: [debug] [BOOTSTRAP] [debug] getElements selector:UiSelector[CLASS=android.widget.RelativeLayout] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (0) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=0] info: [debug] Condition unmet after 2064ms. Timing out. info: [debug] Responding to client with success: {“status”:0,”value”:[],”sessionId”:”d3706f15-43ca-4f07-89a1-177a3f0a5af2”} info: <– POST /wd/hub/session/d3706f15-43ca-4f07-89a1-177a3f0a5af2/elements 200 2066.230 ms - 74 {“status”:0,”value”:[],”sessionId”:”d3706f15-43ca-4f07-89a1-177a3f0a5af2”} info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:[],”status”:0} info: –> POST /wd/hub/session/d3706f15-43ca-4f07-89a1-177a3f0a5af2/elements {“using”:”class name”,”value”:”android.widget.RelativeLayout”} info: [debug] Waiting up to 0ms for condition info: [debug] Pushing command to appium work queue: [“find”,{“strategy”:”class name”,”selector”:”android.widget.RelativeLayout”,”context”:”“,”multiple”:true}] info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:”action”,”action”:”find”,”params”:{“strategy”:”class name”,”selector”:”android.widget.RelativeLayout”,”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.RelativeLayout using CLASS_NAME with the contextId: multiple: true info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[CLASS=android.widget.RelativeLayout] info: [debug] [BOOTSTRAP] [debug] getElements selector:UiSelector[CLASS=android.widget.RelativeLayout] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (0) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=0] info: [debug] [BOOTSTRAP] [debug] Failed to locate element. Clearing Accessibility cache and retrying. info: [debug] [BOOTSTRAP] [debug] Finding android.widget.RelativeLayout using CLASS_NAME with the contextId: multiple: true info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[CLASS=android.widget.RelativeLayout] info: [debug] [BOOTSTRAP] [debug] getElements selector:UiSelector[CLASS=android.widget.RelativeLayout] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (0) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=0] info: [debug] Condition unmet after 13ms. Timing out. info: [debug] Responding to client with success: {“status”:0,”value”:[],”sessionId”:”d3706f15-43ca-4f07-89a1-177a3f0a5af2”} info: <– POST /wd/hub/session/d3706f15-43ca-4f07-89a1-177a3f0a5af2/elements 200 13.831 ms - 74 {“status”:0,”value”:[],”sessionId”:”d3706f15-43ca-4f07-89a1-177a3f0a5af2”} info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:[],”status”:0} info: –> POST /wd/hub/session/d3706f15-43ca-4f07-89a1-177a3f0a5af2/elements {“using”:”class name”,”value”:”android.widget.RelativeLayout”} info: [debug] Waiting up to 0ms for condition info: [debug] Pushing command to appium work queue: [“find”,{“strategy”:”class name”,”selector”:”android.widget.RelativeLayout”,”context”:”“,”multiple”:true}] info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:”action”,”action”:”find”,”params”:{“strategy”:”class name”,”selector”:”android.widget.RelativeLayout”,”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.RelativeLayout using CLASS_NAME with the contextId: multiple: true info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[CLASS=android.widget.RelativeLayout] info: [debug] [BOOTSTRAP] [debug] getElements selector:UiSelector[CLASS=android.widget.RelativeLayout] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (0) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=0] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (1) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=1] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (2) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=2] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (3) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=3] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (4) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=4] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (5) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=5] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (6) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=6] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (7) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=7] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (8) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=8] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (9) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=9] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (10) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=10] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (11) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=11] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (12) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=12] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (13) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=13] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (14) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=14] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (15) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=15] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (16) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=16] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (17) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=17] info: [debug] [BOOTSTRAP] [debug] Element[] is null: (18) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=18] info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:[{“ELEMENT”:”1”},{“ELEMENT”:”2”},{“ELEMENT”:”3”},{“ELEMENT”:”4”},{“ELEMENT”:”5”},{“ELEMENT”:”6”},{“ELEMENT”:”7”},{“ELEMENT”:”8”},{“ELEMENT”:”9”},{“ELEMENT”:”10”},{“ELEMENT”:”11”},{“ELEMENT”:”12”},{“ELEMENT”:”13”},{“ELEMENT”:”14”},{“ELEMENT”:”15”},{“ELEMENT”:”16”},{“ELEMENT”:”17”},{“ELEMENT”:”18”}],”status”:0} info: [debug] Responding to client with success: {“status”:0,”value”:[{“ELEMENT”:”1”},{“ELEMENT”:”2”},{“ELEMENT”:”3”},{“ELEMENT”:”4”},{“ELEMENT”:”5”},{“ELEMENT”:”6”},{“ELEMENT”:”7”},{“ELEMENT”:”8”},{“ELEMENT”:”9”},{“ELEMENT”:”10”},{“ELEMENT”:”11”},{“ELEMENT”:”12”},{“ELEMENT”:”13”},{“ELEMENT”:”14”},{“ELEMENT”:”15”},{“ELEMENT”:”16”},{“ELEMENT”:”17”},{“ELEMENT”:”18”}],”sessionId”:”d3706f15-43ca-4f07-89a1-177a3f0a5af2”} info: <– POST /wd/hub/session/d3706f15-43ca-4f07-89a1-177a3f0a5af2/elements 200 2670.946 ms - 370 {“status”:0,”value”:[{“ELEMENT”:”1”},{“ELEMENT”:”2”},{“ELEMENT”:”3”},{“ELEMENT”:”4”},{“ELEMENT”:”5”},{“ELEMENT”:”6”},{“ELEMENT”:”7”},{“ELEMENT”:”8”},{“ELEMENT”:”9”},{“ELEMENT”:”10”},{“ELEMENT”:”11”},{“ELEMENT”:”12”},{“ELEMENT”:”13”},{“ELEMENT”:”14”},{“ELEMENT”:”15”},{“ELEMENT”:”16”},{“ELEMENT”:”17”},{“ELEMENT”:”18”}],”sessionId”:”d3706f15-43ca-4f07-89a1-177a3f0a5af2”} info: –> GET /wd/hub/session/d3706f15-43ca-4f07-89a1-177a3f0a5af2/element/1/displayed {} info: [debug] Pushing command to appium work queue: [“element:getAttribute”,{“elementId”:”1”,”attribute”:”displayed”}] info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:”action”,”action”:”element:getAttribute”,”params”:{“elementId”:”1”,”attribute”:”displayed”}} info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION info: [debug] [BOOTSTRAP] [debug] Got command action: getAttribute info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:”true”,”status”:0} info: [debug] Responding to client with success: {“status”:0,”value”:true,”sessionId”:”d3706f15-43ca-4f07-89a1-177a3f0a5af2”} info: <– GET /wd/hub/session/d3706f15-43ca-4f07-89a1-177a3f0a5af2/element/1/displayed 200 32.432 ms - 76 {“status”:0,”value”:true,”sessionId”:”d3706f15-43ca-4f07-89a1-177a3f0a5af2”} info: –> GET /wd/hub/session/d3706f15-43ca-4f07-89a1-177a3f0a5af2/element/1/enabled {} info: [debug] Pushing command to appium work queue: [“element:getAttribute”,{“elementId”:”1”,”attribute”:”enabled”}] info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:”action”,”action”:”element:getAttribute”,”params”:{“elementId”:”1”,”attribute”:”enabled”}} info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION info: [debug] [BOOTSTRAP] [debug] Got command action: getAttribute info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:”true”,”status”:0} info: [debug] Responding to client with success: {“status”:0,”value”:true,”sessionId”:”d3706f15-43ca-4f07-89a1-177a3f0a5af2”} info: <– GET /wd/hub/session/d3706f15-43ca-4f07-89a1-177a3f0a5af2/element/1/enabled 200 9.897 ms - 76 {“status”:0,”value”:true,”sessionId”:”d3706f15-43ca-4f07-89a1-177a3f0a5af2”} info: –> POST /wd/hub/session/d3706f15-43ca-4f07-89a1-177a3f0a5af2/element {“using”:”class name”,”value”:”android.widget.RelativeLayout”} info: [debug] Waiting up to 0ms for condition info: [debug] Pushing command to appium work queue: [“find”,{“strategy”:”class name”,”selector”:”android.widget.RelativeLayout”,”context”:”“,”multiple”:false}] info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:”action”,”action”:”find”,”params”:{“strategy”:”class name”,”selector”:”android.widget.RelativeLayout”,”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 android.widget.RelativeLayout using CLASS_NAME with the contextId: multiple: false info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[CLASS=android.widget.RelativeLayout, INSTANCE=0] info: [debug] Responding to client with success: {“status”:0,”value”:{“ELEMENT”:”19”},”sessionId”:”d3706f15-43ca-4f07-89a1-177a3f0a5af2”} info: <– POST /wd/hub/session/d3706f15-43ca-4f07-89a1-177a3f0a5af2/element 200 18.201 ms - 88 {“status”:0,”value”:{“ELEMENT”:”19”},”sessionId”:”d3706f15-43ca-4f07-89a1-177a3f0a5af2”} info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:{“ELEMENT”:”19”},”status”:0} info: –> POST /wd/hub/session/d3706f15-43ca-4f07-89a1-177a3f0a5af2/touch/perform {“actions”:[{“action”:”tap”,”options”:{“x”:100,”y”:60}}]} info: [debug] Pushing command to appium work queue: [“click”,{“x”:100,”y”:60}] info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:”action”,”action”:”click”,”params”:{“x”:100,”y”:60}} info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION info: [debug] [BOOTSTRAP] [debug] Got command action: click info: [debug] [BOOTSTRAP] [debug] Display bounds: [0,0][720,1280] info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:true,”status”:0} info: [debug] Responding to client with success: {“status”:0,”value”:true,”sessionId”:”d3706f15-43ca-4f07-89a1-177a3f0a5af2”} info: <– POST /wd/hub/session/d3706f15-43ca-4f07-89a1-177a3f0a5af2/touch/perform 200 111.929 ms - 76 {“status”:0,”value”:true,”sessionId”:”d3706f15-43ca-4f07-89a1-177a3f0a5af2”} info: –> DELETE /wd/hub/session/d3706f15-43ca-4f07-89a1-177a3f0a5af2 {} info: Shutting down appium session info: [debug] Pressing the HOME button info: [debug] executing cmd: D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb.exe -s 127.0.0.1:21503 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: 17.455 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”:”d3706f15-43ca-4f07-89a1-177a3f0a5af2”} info: <– DELETE /wd/hub/session/d3706f15-43ca-4f07-89a1-177a3f0a5af2 200 364.987 ms - 76 {“status”:0,”value”:null,”sessionId”:”d3706f15-43ca-4f07-89a1-177a3f0a5af2”}

转载请注明原文地址: https://www.6miu.com/read-77159.html

最新回复(0)