Robotframework-Appium 之常用API(一)
上一遍隨筆(https://www.cnblogs.com/cnkemi/p/9639809.html)用Python + Robotframework + Appium對Android app小試牛刀啦,了解了其完全也可以做操作APP的,然後簡單說明了其環境搭建。
下面來介紹下Robotframework-Appium常用的API,掌握其api就可以做更多的操作啦!
1. Name: Background App
Source: AppiumLibrary <test library>
Arguments: [ seconds=5 ]
Puts the application in the background on the device for a certain duration.
将应用程序放在设备的后台一段时间。
2. Name: Capture Page Screenshot
Source: AppiumLibrary <test library>
Arguments: [ filename=None ]
Takes a screenshot of the current page and embeds it into the log.
获取当前页面的屏幕截图并将其嵌入到日志中。
`filename` argument specifies the name of the file to write the screenshot into. If no `filename` is given, the screenshot is saved into file `appium-screenshot-<counter>.png` under the directory where the Robot Framework log file is written into. The `filename` is also considered relative to the same directory, if it is not given in absolute format.
3. Name: Clear Text
Source: AppiumLibrary <test library>
Arguments: [ locator ]
Clears the text field identified by `locator`.
清除已定位的文本字段。
See `introduction` for details about locating elements.
4. Name: Click A Point
Source: AppiumLibrary <test library>
Arguments: [ x=0 | y=0 | duration=100 ]
Click on a point.
点击一个点
5. Name: Click Element
Source: AppiumLibrary <test library>
Arguments: [ locator ]
Click element identified by `locator`.
单击已定位的元素。
6. Name: Close All Applications
Source: AppiumLibrary <test library>
Arguments: [ ]
Closes all open applications.
关闭所有打开的应用程序。
This keyword is meant to be used in test or suite teardown to make sure all the applications are closed before the test execution finishes.
After this keyword, the application indices returned by `Open Application` are reset and start from `1`.
7. Name: Close Application
Source: AppiumLibrary <test library>
Arguments:[ ]
Closes the current application and also close webdriver session.
关闭当前应用程序并关闭webdriver会话。
8. Name: Element Should Be Disabled
Source: AppiumLibrary <test library>
Arguments: [ locator | loglevel=INFO ]
Verifies that element identified with locator is disabled.
验证已定位标识的元素已禁用。
Key attributes for arbitrary elements are `id` and `name`. See `introduction` for details about locating elements.
9. Name: Element Should Be Enabled
Source: AppiumLibrary <test library>
Arguments: [ locator | loglevel=INFO ]
Verifies that element identified with locator is enabled.
验证已定位标识的元素是是否可用。
Key attributes for arbitrary elements are `id` and `name`. See `introduction` for details about locating elements.
10. Name: Element Should Be Visible
Source: AppiumLibrary <test library>
Arguments: [ locator | loglevel=INFO ]
Verifies that element identified with locator is visible.
验证已定位标识的元素是否可见。
Key attributes for arbitrary elements are `id` and `name`. See `introduction` for details about locating elements.
New in AppiumLibrary 1.4.5
11. Name: Element Should Contain Text
Source: AppiumLibrary <test library>
Arguments: [ locator | expected | message= ]
Verifies element identified by locator contains text expected.
验证已定位标识的元素包含预期的文本。
If you wish to assert an exact (not a substring) match on the text of the element, use `Element Text Should Be`.
Key attributes for arbitrary elements are id and xpath. message can be used to override the default error message.
New in AppiumLibrary 1.4.5
12. Name: Element Should Not Contain Text
Source: AppiumLibrary <test library>
Arguments: [ locator | expected | message= ]
Verifies element identified by locator does not contain text expected.
验证已定位标识的元素不包含预期的文本。
message can be used to override the default error message. See `Element Should Contain Text` for more details.
13. Name: Element Text Should Be
Source: AppiumLibrary <test library>
Arguments: [ locator | expected | message= ]
Verifies element identified by locator exactly contains text expected.
验证已定位标识的元素是否包含预期的文本。
In contrast to `Element Should Contain Text`, this keyword does not try a substring match but an exact match on the element identified by locator.
message can be used to override the default error message.
New in AppiumLibrary 1.4.5
14. Name: Get Activity
Source: AppiumLibrary <test library>
Arguments: [ ]
Retrieves the current activity on the device.
检索设备上的当前活动。
Android only.
15. Name: Get Capability
Source: AppiumLibrary <test library>
Arguments: [ capability_name ]
Return the desired capability value by desired capability name.
16. Name: Get Current Context
Source: AppiumLibrary <test library>
Arguments:[ ]
Get current context.
获取当前文本。
17. Name: Get Element Location
Source: AppiumLibrary <test library>
Arguments: [ locator ]
Get element location.
获取元素位置。
Key attributes for arbitrary elements are `id` and `name`. See `introduction` for details about locating elements.
18. Name: Get Element Size
Source: AppiumLibrary <test library>
Arguments: [ locator ]
Get element size.
获取元素大小。
Key attributes for arbitrary elements are `id` and `name`. See `introduction` for details about locating elements.
19. Name: Get Text
Source: AppiumLibrary <test library>
Arguments: [ locator ]
Get element text (for hybrid and mobile browser use `xpath` locator, others might cause problem) .
获取元素文本。
Example:
${text} Get Text //*[contains(@text,'foo')]
New in AppiumLibrary 1.4.6
20. Name: Get Source
Source: AppiumLibrary <test library>
Arguments: [ ]
Returns the entire source of the current page.
返回当前页面的源文件。
21. Name: Get Webelement
Source: AppiumLibrary <test library>
Arguments: [ locator ]
Returns the first WebElement object matching locator.
返回匹配定位符的第一个WebElement对象。
Example:
${element} Get Webelement id=my_element
Click Element ${element}
22. Name: Get Window Height
Source: AppiumLibrary <test library>
Arguments: [ ]
Get current device height.
获取当前设备高度。
Example:
${width} Get Window Height
${height} Get Window Height
Click A Point ${width ${height}
New in AppiumLibrary 1.4.5
23. Name: Get Window Width
Source: AppiumLibrary <test library>
Arguments: [ ]
Get current device width.
获取当前设备宽度。
Example:
${width} Get Window Height
${height} Get Window Height
Click A Point ${width ${height}
New in AppiumLibrary 1.4.5
24. Name: Go Back
Source: AppiumLibrary <test library>
Arguments:[ ]
Goes one step backward in the browser history.
在浏览器历史记录中向后退一步。
25. Name: Go To Url
Source: AppiumLibrary <test library>
Arguments: [ url ]
Opens URL in default web browser.
在默认Web浏览器中打开URL。
26. Name: Input Password
Source: AppiumLibrary <test library>
Arguments: [ locator | text ]
Types the given password into text field identified by `locator`.
在已定位标识的文本框里键入密码。
Difference between this keyword and `Input Text` is that this keyword does not log the given password. See `introduction` for details about locating elements.
27. Name: Input Text
Source: AppiumLibrary <test library>
Arguments: [ locator | text ]
Types the given `text` into text field identified by `locator`.
在已定位标识的文本框里键入给定的文本。
See `introduction` for details about locating elements.
先學習這些吧!熟悉掌握這些API,讓其做更多的事,還有常用API(二)會後繼更新~
Robotframework-Appium 之常用API(一)的更多相关文章
- Appium之常用API
Appium常用API解析 1.current_activity:获取当前页面的activity名,比如com.taobao.tao.TBMainActivity 或 com.taobao.brows ...
- appium自动化常用API
常用函数 一.获得信息类API (1)获取当前页面的activity名,比如: (.ui.login.ViewPage) current_activity() 比如我们需要实现这个登录的功能时,主要 ...
- Robotframework + Appium 之常用元素定位方法
任何自动化测试,其实手动测试也是一样的,元素定位(目标定位)是首要任务,这是最直接的测试对象呀! 好了,废话不多说,又到了元素定位啦,之前我们已经介绍过selenium及appium常用的定位方法,下 ...
- Appium driver常用API
click driver.find_element implicitly_wait send_keys close quit get_window_size switch_to execute bac ...
- 7、Appium常用API
嗯,官网已经介绍的很全了.会选几个常用API后期整理. Appium常用API地址:http://appium.io/docs/cn/writing-running-appium/appium-bin ...
- Appium常用API(二)
接前面的常用API(一),本文接着介绍如下: 1.press_keycode press_keycode(self, keycode, metastate=None): Sends a keycode ...
- 【转】RobotFrameWork+APPIUM实现对安卓APK的自动化测试----第二篇【原理】
接着上一篇,我们开始聊聊APPIUM的框架和运行模式.废话不多说直接上图. 1.首先自动化脚本通过RobotFrameWork将命令传递给Appium的客户端: 2.然后[Appium的客户端]将接受 ...
- RobotFrameWork+APPIUM实现对安卓APK的自动化测试----第二篇【原理】
http://blog.csdn.net/deadgrape/article/details/50574459 接着上一篇,我们开始聊聊APPIUM的框架和运行模式.废话不多说直接上图. 1.首先自动 ...
- 基于appium的常用元素定位方法
一.元素定位工具 app应用的元素使用的是控件定位,不同于web网页,web网页定位元素通常使用的是F12工具,那么在app当中我们则要借助其它的工具来辅助定位. 1.uiautomatorviewe ...
随机推荐
- CentOS7.2部署FTP
目前Linux大部分部署的FTP服务器都是vsftpd,至于为什么,暂时没什么必要深究. 1.安装vsftpd # yum check-update //检查可更新的程序,也可以不更新直接安装,以防万 ...
- zookeeper 运维
尽管zookeeper在编程上有很多的阱陷,API也非常的难用,但zookeeper服务本身可以说是很牢靠的了,所以在网上貌似关于运维的文章比较少. 但省心并不代表不会出麻烦,下面总结下zookeep ...
- 【POJ】1185 炮兵阵地(状压dp)
题目 传送门:QWQ 分析 看到$ M<=10 $考虑状压. 然后把每行都压一下,那么每个状态相关的就是上一行和上上行的状态. 然后枚举. 然后复杂度最坏是$ O(100 \times 1024 ...
- TNS-12535: TNS:operation timed out、TNS-00505: Operation timed out
在查看alert日志的时候发现: 1 *********************************************************************** 2 3 Fatal ...
- 分布式锁实践(二)-ZooKeeper实现总结
写在最前面 前几周写了篇 利用Redis实现分布式锁 ,今天简单总结下ZooKeeper实现分布式锁的过程.其实生产上我只用过Redis或者数据库的方式,之前还真没了解过ZooKeeper怎么实现分布 ...
- Python之分布式监控系统开发
为什么要做监控? –熟悉IT监控系统的设计原理 –开发一个简版的类Zabbix监控系统 –掌握自动化开发项目的程序设计思路及架构解藕原则 常用监控系统设计讨论 Zabbix Nagios 监控系统需求 ...
- 好记性不如烂笔头-linux学习笔记2kickstart自动化安装和cacti
kickstart自动化安装的逻辑梳理 主要是安装tftp nfs dhcp 然后配置kickstart 原来就是先安装tftp 可实现不同机器的文件下载 然后在安装nfs 就是主服务器的文件系统 然 ...
- JS表单常见表达式(正则)
整数或者小数:^[0-9]+\.{0,1}[0-9]{0,2}$ 只能输入数字:"^[0-9]*$". 只能输入n位的数字:"^\d{n}$". 只能输入至少n ...
- OpenCL Hello World
▶ OpenCL 的环境配置与第一个程序 ● CUDA 中自带 OpenCL 需要的头文件和库,直接拉近项目里边去就行:AMD 需要下载 AMD APP SDK(https://community.a ...
- Requests抓取火车票数据
1.数据接口 https://kyfw.12306.cn/otn/lcxxcx/query?purpose_codes=ADULT&queryDate=2016-08-01&from_ ...