(转)AppiumLibrary基本操作
*** Settings ***
Library AppiumLibrary
Library Collections
Library String
Library Dialogs
*** Test Cases ***
打开app
Comment Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator'
... app=${CURDIR}/Tudou_Phone_tudouweb.apk
Comment Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator'
... appActivity=com.tudou.ui.activity.WelcomeActivity appPackage=com.tudou.android
Comment Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator'
... browserName=Chrome
Comment Go To Url http://www.baidu.com
后台app
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android
sleep 10s
Background App 5
关闭app
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android
sleep 10s
Close All Applications
删除app
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android
Remove Application com.tudou.android
重置app
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android
Pause Execution
Reset Application
定位
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android
Pause Execution
Comment Click Element id=com.tudou.android:id/mytudouText
Comment Click Element name=我的
Comment Click Element xpath=//android.widget.TextView[contains(@text,'我的')]
Comment Click Element class="android".widget.TextView
Click Element android=new UiSelector().text("我的")
Pause Execution
Close All Applications
输入
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Comment Input Text id=com.tudou.android:id/login_name asdasd
Comment Input Text id=com.tudou.android:id/login_pwd 2312121
Comment Input Value id=com.tudou.android:id/login_name 34534534sdf
按键
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Comment Press Keycode 3
Comment Press Keycode 24
清空内容
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Clear Text id=com.tudou.android:id/login_name
点击按钮
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Click Button 我的
Comment Click Button 确定
点击元素
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Click Element name=我的
Click Element name=马上登录
Click Element id=com.tudou.android:id/title_right_text
点击坐标
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Click A Point 300 200
tap
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Tap name=我的
Tap name=马上登录
Tap id=com.tudou.android:id/title_right_text
Landscape
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' browserName=Chrome
... unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Landscape
隐藏键盘
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Hide Keyboard
摇一摇
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Shake
network
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
${a} Get Network Connection Status
Set Network Connection Status 1
滑动
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Swipe 500 500 100 500 500
sleep 2s
Swipe 500 500 100 500 500
scroll
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Comment Scroll name=牛男网 name=畅所欲言秀
Scroll To id=com.tudou.android:id/channel_subclass
zoom
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.baidu.baidumaps.WelcomeScreen
... appPackage=com.baidu.BaiduMap unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Pinch id=com.tudou.android:id/channel_subclass 200% 50
get
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Comment Get Element Attribute
Comment Get Element Location
Comment Get Element Size
Comment Get Elements
Comment Get Source
Comment Log Source
shoudl
Element Attribute Should Match
Element Name Should Be
Element Should Be Disabled
Element Should Be Enabled
Element Value Should Be
Page Should Contain Element
Page Should Contain Text
Page Should Not Contain Element
Page Should Not Contain Text
webview
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
${a} Get Contexts
${b} Get Current Context
Switch To Context ${a[1]}
Log Source
Comment Click Element xpath=//a[text()='开挂!那些牛逼闪闪的牛人们']
Go To Url http://www.w3school.com.cn/tiy/t.asp?f=jsref_dialog_create
Pause Execution
Sleep 2s
Select Frame name=i
Click Element //button[text()='试一下']
Sleep 2s
Unselect Frame
Click Element //input[@value='提交代码']
${url} Get Element Attribute xpath=//*[@id="footer"]/p/a href
webview2
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android
Pause Execution
${a} Get Contexts
${b} Get Current Context
Switch To Context ${a[1]}
Go To Url http://www.w3school.com.cn/tiy/loadtext.asp?f=html_dropdownbox
Pause Execution
Wait Until Page Contains Element name=cars
Select From List name=cars Fiat
Comment Click Element name=cars
Comment Switch To Context ${a[0]}
Comment Click Element name=Audi
Comment Switch To Context ${a[1]}
Get Element Attribute 图片位置 src
webview3
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android
Pause Execution
${contexts} Get Contexts
Switch To Context ${contexts[1]}
Click Element //a[text()='午夜计程车:北漂少女酒吧求生']
(转)AppiumLibrary基本操作的更多相关文章
- Key/Value之王Memcached初探:二、Memcached在.Net中的基本操作
一.Memcached ClientLib For .Net 首先,不得不说,许多语言都实现了连接Memcached的客户端,其中以Perl.PHP为主. 仅仅memcached网站上列出的语言就有: ...
- Android Notification 详解(一)——基本操作
Android Notification 详解(一)--基本操作 版权声明:本文为博主原创文章,未经博主允许不得转载. 微博:厉圣杰 源码:AndroidDemo/Notification 文中如有纰 ...
- Android Notification 详解——基本操作
Android Notification 详解 版权声明:本文为博主原创文章,未经博主允许不得转载. 前几天项目中有用到 Android 通知相关的内容,索性把 Android Notificatio ...
- 三、Redis基本操作——List
小喵的唠叨话:前面我们介绍了Redis的string的数据结构的原理和操作.当时我们提到Redis的键值对不仅仅是字符串.而这次我们就要介绍Redis的第二个数据结构了,List(链表).由于List ...
- 二、Redis基本操作——String(实战篇)
小喵万万没想到,上一篇博客,居然已经被阅读600次了!!!让小喵感觉压力颇大.万一有写错的地方,岂不是会误导很多筒子们.所以,恳请大家,如果看到小喵的博客有什么不对的地方,请尽快指正!谢谢! 小喵的唠 ...
- 一、Redis基本操作——String(原理篇)
小喵的唠叨话:最近京东图书大减价,小喵手痒了就买了本<Redis设计与实现>[1]来看看.这里权当小喵看书的笔记啦.这一系列的模式,主要是先介绍Redis的实现原理(可能很大一部分会直接照 ...
- Linq查询基本操作
摘要:本文介绍Linq查询基本操作(查询关键字) - from 子句 - where 子句 - select子句 - group 子句 - into 子句 - orderby 子句 - join 子句 ...
- C++ map的基本操作和使用
原文地址:http://blog.sina.com.cn/s/blog_61533c9b0100fa7w.html Map是c++的一个标准容器,她提供了很好一对一的关系,在一些程序中建立一个map可 ...
- python之最强王者(10)———文件(File)、输入输出的基本操作
1. Python 文件I/O 本章只讲述所有基本的的I/O函数,更多函数请参考Python标准文档. 2.打印到屏幕 最简单的输出方法是用print语句,你可以给它传递零个或多个用逗号隔开的表达式. ...
随机推荐
- PHP store session with couchbase
如何用couchbase存储session 有两种常见方式:1.采用memcache模式连接couchbase 只需两句修改: ini_set('session.save_handler', 'mem ...
- java多线程总结
java中的多线程 一般来说,当运行一个应用程序的时候,就启动了一个进程,当然有些会启动多个进程.启动进程的时候,操作系统会为进程分配资源,其中最主要的资源是内存空间,因为程序是在内存中运行的.在进程 ...
- 开始JavaScript
将脚本放在那里? 将本可以放在HTML页面上的两个位置:<head>和</head>标签之间(称为头脚本,header script),或者<body>和</ ...
- Scrum领取任务
这次主要讨论了产品的构造流程,怎么将任务分配到个人,讨论什么功能具体怎么实现,然后各自选取了任务. 在团队项目“广商百货”的SCRUM项目中我认领的任务是对登录功能的实现.现在还没正式开始,还在看书和 ...
- java 转换流
OutputStreamWriter 是字符流通向字节流的桥梁:可使用指定的 charset 将要写入流中的字符编码成字节.它使用的字符集可以由名称指定或显式给定,否则将接受平台默认的字符集. imp ...
- C#读写文件的方法汇总_C#教程_脚本之家
C#读写文件的方法汇总_C#教程_脚本之家 http://www.jb51.net/article/34936.htm
- iOS交互WebService(cxf框架)
公司后台java用的cxf框架,说是iOS.Android.web客户端都可以通用,但是我还是第一次遇到,所以做的时候遇到了不小的坑.下面总结下我开发中遇到的问题以及解决方案: 首先,后台提供了一份接 ...
- 2016 - 2 - 19 ARC内存管理知识总结(一,arc基本概念及alloc等方法的实现)
一. ARC的基本概念 1. 在objc中采用automatic reference counting 机制, 让编译器来进行内存管理.在降低程序崩溃,内存管理泄漏等风险的同时,很大程度减少了程序员的 ...
- BZOJ 4518 征途
斜率优化.又是变量名打错看了老半天. 把方差式子展开一下就好了. #include<iostream> #include<cstdio> #include<cstring ...
- android view:手势
一直认为android手势识别很是神奇,我们不分析复杂的手势,仅仅是针对上一次的基本事件的手势处理,分析GestureDetector的源码,来看一下到底手势事件是如何定义的. GestureDete ...