一、介绍
AppiumLibrary 是 Robot Framework 的App测试库。
它使用Appium 与Android 和 iOS应用程序进行通信,类似于Selenium WebDriver与Web浏览器的对话。
AppiumLibrary是继承和引用appiumandroidlibrary,但重新实现使用appium 1.X技术,它完全支持Python 2.7,但对python 3.3+的支持仍然是实验性的。
二、定位控件
AppiumLibrary需要在应用程序中查找元素的所有关键字都使用参数locator。
当提供locator值时,它将与特定元素类型的键属性进行匹配。支持的定位器(locator)有:
| 定位器 | 格式 | 描述 |
| identifier | Click Element | identifier=my_element | 匹配 @id 或 @name 属性 |
| id | Click Element | id=my_element | 匹配 @id 属性 |
| name | Click Element | name=my_element | 匹配 @name 属性 |
| xpath | Click Element | xpath=//UIATableView/UIATableCell/UIAButton | 匹配 XPath |
| class | Click Element | class=UIAPickerWheel | 匹配 class name |
| accessibility_id | Click Element | accessibility_id=t | 匹配 辅助选项 |
| android | Click Element | android=new UiSelector().description('Apps') | 匹配 Android UI Automator |
| ios | Click Element | ios=.buttons().withName('Apps') | 匹配 iOS UI Automation |
| css | Click Element | css=.green_button | 匹配 css in webview |
三、定位工具
1. Appium通过 uiautomatorviewer.bat工具来查看控件的属性,该工具位于Android SDK的Tools目录下。

2. 双击打开即可,为了方便起见,建议添加快捷方式到桌面。
