RobotFramework自动化测试框架-移动手机自动化测试Open Application关键字的使用
在AppiumLibrary库中,Open Application关键字用来打开一个待测试移动APP。
示例1:连接本机已经打开的appium服务端,打开一个待测试的安卓APP,指定测试平台为Android,测试的手机deviceName为98YFBP522VSU,需要打开的APP路径为C:/Users/yongqing/Desktop/app-debug.apk,APP的包名为com.example.calculator,启动的appActivity为MainActivity
Open Application http://localhost:4723/wd/hub platformName=Android platformVersion=22 deviceName=98YFBP522VSU app=C:/Users/yongqing/Desktop/app-debug.apk appPackage=com.example.calculator appActivity=MainActivity
执行结果:

执行完成后,在手机上会自动打开指定的APP

Appium端会打印如下运行输出日志:
> info: Found device 98YFBP522VSU
> info: [debug] Setting device id to 98YFBP522VSU
> info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
> info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU wait-for-device
> info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU shell "echo 'ready'"
> info: [debug] Starting logcat capture
> info: [debug] Getting device API level
> info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU shell "getprop ro.build.version.sdk"
> info: [debug] Device is at API Level 22
> info: Device API level is: 22
> info: [debug] Extracting strings for language: default
> info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU shell "getprop persist.sys.language"
> info: [debug] Current device persist.sys.language:
> info: [debug] java -jar "F:\selenium\appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "C:\Users\yongqing\Desktop\app-debug.apk" "C:\Users\yongqing\AppData\Local\Temp\com.example.calculator"
> info: [debug] Reading strings from converted strings.json
> info: [debug] Setting language to default
> info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU push "C:\\Users\\yongqing\\AppData\\Local\\Temp\\com.example.calculator\\strings.json" /data/local/tmp
> info: [debug] Checking whether aapt is present
> info: [debug] Using aapt from E:\android-sdk-windows\build-tools\24.0.1\aapt.exe
> info: [debug] Retrieving process from manifest.
> info: [debug] executing cmd: E:\android-sdk-windows\build-tools\24.0.1\aapt.exe dump xmltree C:\Users\yongqing\Desktop\app-debug.apk AndroidManifest.xml
> info: [debug] Set app process to: com.example.calculator
> info: [debug] Not uninstalling app since server not started with --full-reset
> info: [debug] Checking app cert for C:\Users\yongqing\Desktop\app-debug.apk.
> info: [debug] executing cmd: java -jar F:\selenium\appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar C:\Users\yongqing\Desktop\app-debug.apk
> info: [debug] App already signed.
> info: [debug] Zip-aligning C:\Users\yongqing\Desktop\app-debug.apk
> info: [debug] Checking whether zipalign is present
> info: [debug] Using zipalign from E:\android-sdk-windows\build-tools\24.0.1\zipalign.exe
> info: [debug] Zip-aligning apk.
> info: [debug] executing cmd: E:\android-sdk-windows\build-tools\24.0.1\zipalign.exe -f 4 C:\Users\yongqing\Desktop\app-debug.apk C:\Users\yongqing\AppData\Local\Temp\117315-3596-1p9lthv\appium.tmp
> info: [debug] MD5 for app is 6192e720723dd8700a640a5fb7c59cd2
> info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU shell "ls /data/local/tmp/6192e720723dd8700a640a5fb7c59cd2.apk"
> info: [debug] Getting install status for com.example.calculator
> info: [debug] Getting device API level
> info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU shell "getprop ro.build.version.sdk"
> info: [debug] Device is at API Level 22
> info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU shell "pm list packages -3 com.example.calculator"
> info: [debug] App is installed
> info: App is already installed, resetting app
> info: [debug] Running fast reset (stop and clear)
> info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU shell "am force-stop com.example.calculator"
> info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU shell "pm clear com.example.calculator"
> info: [debug] Forwarding system:4724 to device:4724
> info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU forward tcp:4724 tcp:4724
> info: [debug] Pushing appium bootstrap to device...
> info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU push "F:\\selenium\\appium\\node_modules\\appium\\build\\android_bootstrap\\AppiumBootstrap.jar" /data/local/tmp/
> info: [debug] Pushing settings apk to device...
> info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU install "F:\selenium\appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk"
> info: [debug] Pushing unlock helper app to device...
> info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU install "F:\selenium\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: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU shell "ps 'uiautomator'"
> info: [debug] No matching processes found
> info: [debug] Running bootstrap
> info: [debug] spawning: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.example.calculator -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] Waking up device if it's not alive
> info: [debug] Pushing command to appium work queue: ["wake",{}]
> 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: {"status":0,"value":true}
> info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU 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: {"status":0,"value":"\/data\/local\/tmp"}
> info: [debug] dataDir set to: /data/local/tmp
> 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: {"status":0,"value":false}
> info: [debug] Getting device API level
> info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU shell "getprop ro.build.version.sdk"
> info: [debug] Device is at API Level 22
> info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.example.calculator/MainActivity"
> info: [debug] We tried to start an activity that doesn't exist, retrying with . prepended to activity
> info: [debug] Getting device API level
> info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU shell "getprop ro.build.version.sdk"
> info: [debug] Device is at API Level 22
> info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.example.calculator/.MainActivity"
> info: [debug] Waiting for pkg "com.example.calculator" and activity "MainActivity" to be focused
> info: [debug] Getting focused package and activity
> info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU shell "dumpsys window windows"
> info: [debug] executing cmd: E:\android-sdk-windows\platform-tools\adb.exe -s 98YFBP522VSU shell "getprop ro.build.version.release"
> info: [debug] Device is at release version 5.1
> 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 090a2542-63ee-4e1b-912f-32d67922d49e
> info: <-- POST /wd/hub/session 303 13662.949 ms - 74
> info: --> GET /wd/hub/session/090a2542-63ee-4e1b-912f-32d67922d49e {}
> info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"5.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"deviceName":"98YFBP522VSU","app":"C:/Users/yongqing/Desktop/app-debug.apk","platformVersion":"22","appPackage":"com.example.calculator","platformName":"Android","appActivity":"MainActivity"},"deviceName":"98YFBP522VSU","app":"C:/Users/yongqing/Desktop/app-debug.apk","appPackage":"com.example.calculator","platformName":"Android","appActivity":"MainActivity"},"sessionId":"090a2542-63ee-4e1b-912f-32d67922d49e"}
> info: <-- GET /wd/hub/session/090a2542-63ee-4e1b-912f-32d67922d49e 200 2.395 ms - 686 {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"5.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"deviceName":"98YFBP522VSU","app":"C:/Users/yongqing/Desktop/app-debug.apk","platformVersion":"22","appPackage":"com.example.calculator","platformName":"Android","appActivity":"MainActivity"},"deviceName":"98YFBP522VSU","app":"C:/Users/yongqing/Desktop/app-debug.apk","appPackage":"com.example.calculator","platformName":"Android","appActivity":"MainActivity"},"sessionId":"090a2542-63ee-4e1b-912f-32d67922d49e"}
【原文归作者所有,欢迎转载,但是保留版权】
RobotFramework自动化测试框架-移动手机自动化测试Open Application关键字的使用的更多相关文章
- RobotFramework自动化测试框架-移动手机自动化测试AppiumLibrary介绍
在使用AppiumLibrary库时,需要预先安装好Appium自动化工具,Appium官网地址为:http://appium.io/ Appium的GitHub地址为:https://github. ...
- RobotFramework自动化测试框架-移动手机自动化测试AppiumLibrary库其它的常见自动化关键字
关键字 使用描述 Close Application 关闭掉当前已经打开的APP Application,该关键字不需要接收任何的参数,但是使用该关键字的前提是已经打开了一个APP Applicati ...
- RobotFramework自动化测试框架-移动手机自动化测试Input Text和Click Button关键字的使用
Input Text和Click Button Input Text 关键字一般用来给输入框进行输入操作,该关键字接收两个参数[ locator | text ]. 示例1:启动安卓手机上一个APP的 ...
- RobotFramework自动化测试框架-移动手机自动化测试Get Network Connection Status和Set Network Connection Status关键字的使用
Get Network Connection Status关键字用来获取手机的网络连接状态.在获取到连接状态后,会返回不同的数字. Set Network Connection Status关键字用来 ...
- RobotFramework自动化测试框架-移动手机自动化测试Clear Text关键字的使用
Clear Text关键字用来清除输入框的数据,该关键字接收一个参数[ locator ],这里的locator指的就是界面元素的定位方式. 示例1:Clear Text清除输入框数据时,采用reso ...
- RobotFramework自动化测试框架-移动手机自动化测试Click Element关键字的使用
Click Element关键字用来模拟点击APP界面上的一个元素,该关键字接收一个参数[ locator ] ,这里的locator指的是界面元素的定位方式. 示例1:使用Click Element ...
- RobotFramework自动化测试框架-移动手机自动化测试Click A Point关键字的使用
Click A Point关键字用来模拟点击APP界面上的一个点,该关键字接收两个三个参数[ x=0 | y=0 | duration=100 ],x和y代表的是点的坐标位置,duration代表的是 ...
- RobotFramework自动化测试框架-移动手机自动化测试Click Element At Coordinates关键字的使用
Click Element At Coordinates关键字通过一个具体的坐标点,来模拟点击一个Element,该关键字接收两个参数[ coordinate_X | coordinate_Y ]. ...
- RobotFramework自动化测试框架-移动手机自动化测试Get Element Location关键字的使用
Get Element Location关键字用来获取一个Element的Location位置,该关键字接收一个参数[ locator ] 示例1:使用Get Element Location来获取一 ...
随机推荐
- Netty(一):入门篇
匠心零度 转载请注明原创出处,谢谢! 说在前面 上篇文章对Netty进行了初探:Netty初探,主要介绍了下我们为什么需要学习netty.netty介绍等:本篇文章接着上篇文章的内容.本篇为了方便大家 ...
- 在 CentOS7.0 上搭建 Chroot 的 Bind DNS 服务器
BIND(Berkeley internet Name Daemon)也叫做NAMED,是现今互联网上使用最为广泛的DNS 服务器程序.这篇文章将要讲述如何在 chroot 监牢中运行 BIND,这样 ...
- httpd的三种模式比较
查看你的httpd使用了哪种模式: /usr/local/apache2/bin/httpd -V |grep 'Server MPM' 使用哪种模式,需要在编译的时候指定 --with-mpm=pr ...
- Visual Studio 2017 Enterprise 发布 15.3.2 版,附离线安装包下载。
Visual Studio 2017 Enterprise 更新至 15.3.2 ,本安装包使用微软原版安装文件,配合layout指令全量下载后制作,内置中文语言包,包含 Visual Studio ...
- 阶乘之和 输入n,计算S=1!+2!+3!+…+n!的末6位(不含前导0)。n≤10 6 ,n!表示 前n个正整数之积。
阶乘之和输入n,计算S=1!+2!+3!+…+n!的末6位(不含前导0).n≤10 6 ,n!表示前n个正整数之积.样例输入:10样例输出: package demo; import java.uti ...
- iOS isa指针
在Objective-C中,任何类的定义都是对象.类和类的实例没有任何本质上的区别.任何对象都有isa指针. isa:是一个Class 类型的指针. 每个实例对象有个isa的指针,它指向对象的类,而C ...
- React Native填坑之旅 -- 回归小插曲
回归RN,非常开心啊! 在React Native 0.49.5上开发,直接遇到一个ios模拟器的问题.这个问题很简单就是Bundle URL not present. 在网上找了很多的解决方法,都不 ...
- 关于Spring事务的原理,以及在事务内开启线程,连接池耗尽问题.
主要以结果为导向解释Spring 事务原理,连接池的消耗,以及事务内开启事务线程要注意的问题. Spring 事务原理这里不多说,网上一搜一大堆,也就是基于AOP配合ThreadLocal实现. 这里 ...
- 详解Java的自动装箱与拆箱(Autoboxing and unboxing)
一.什么是自动装箱拆箱 很简单,下面两句代码就可以看到装箱和拆箱过程 //自动装箱 Integer total = 99; //自定拆箱 int totalprim = total; 简单一点说,装箱 ...
- Android 热补丁实践之路
最新github上开源了很多热补丁动态修复框架,主要的大致有: https://github.com/dodola/HotFix https://github.com/jasonross/Nuwa h ...