Library version: | 1.4.6 |
---|---|
Library scope: | global |
Named arguments: | supported |
AppiumLibrary is a Mobile App testing library for Robot Framework.css
All keywords in AppiumLibrary that need to find an element on the page take an argument, either a locator
or a webelement
. locator
is a string that describes how to locate an element using a syntax specifying different location strategies. webelement
is a variable that holds a WebElement instance, which is a representation of the element.html
By default, when a locator is provided, it is matched against the key attributes of the particular element type. For iOS and Android, key attribute is id
for all elements and locating elements is easy using just the id
. For example:java
Click Element id=my_element
New in AppiumLibrary 1.4, id
and xpath
are not required to be specified, however xpath
should start with //
else just use xpath
locator as explained below.python
For example:android
Click Element my_element Wait Until Page Contains Element //*[@type="android.widget.EditText"]
Appium additionally supports some of the Mobile JSON Wire Protocol locator strategies. It is also possible to specify the approach AppiumLibrary should take to find an element by specifying a lookup strategy with a locator prefix. Supported strategies are:ios
Strategy | Example | Description | Note |
identifier | Click Element | identifier=my_element | Matches by @id attribute | |
id | Click Element | id=my_element | Matches by @resource-id attribute | |
accessibility_id | Click Element | accessibility_id=button3 | Accessibility options utilize. | |
xpath | Click Element | xpath=//UIATableView/UIATableCell/UIAButton | Matches with arbitrary XPath | |
class | Click Element | class=UIAPickerWheel | Matches by class | |
android | Click Element | android=UiSelector().description('Apps') | Matches by Android UI Automator | |
ios | Click Element | ios=.buttons().withName('Apps') | Matches by iOS UI Automation | |
css | Click Element | css=.green_button | Matches by css in webview | |
name | Click Element | name=my_element | Matches by @name attribute | Only valid for Selendroid |
Starting with version 1.4 of the AppiumLibrary, one can pass an argument that contains a WebElement instead of a string locator. To get a WebElement, use the new Get WebElements or Get WebElement keyword.git
For example:github
@{elements} Get Webelements class=UIAButton Click Element @{elements}[2]
Arguments | Documentation | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
timeout=5, run_on_failure=Capture Page Screenshot | AppiumLibrary can be imported with optional arguments.web
By default Capture Page Screenshot will be used to take a screenshot of the current page. Using the value No Operation will disable this feature altogether. See Register Keyword To Run On Failure keyword for more information about this functionality. Examples:
|
Background App · Capture Page Screenshot · Clear Text · Click A Point · Click Button · Click Element · Click Element At Coordinates · Click Text · Close All Applications · Close Application · Element Attribute Should Match ·Element Name Should Be · Element Should Be Disabled · Element Should Be Enabled · Element Should Be Visible · Element Should Contain Text · Element Should Not Contain Text · Element Text Should Be · Element Value Should Be ·Get Activity · Get Appium SessionId · Get Appium Timeout · Get Capability · Get Contexts · Get Current Context · Get Element Attribute · Get Element Location · Get Element Size · Get Matching Xpath Count ·Get Network Connection Status · Get Source · Get Text · Get Webelement · Get Webelements · Get Window Height · Get Window Width · Go Back · Go To Url · Hide Keyboard · Input Password · Input Text · Input Value · Install App ·Landscape · Launch Application · Lock · Log Source · Long Press · Long Press Keycode · Open Application · Page Should Contain Element · Page Should Contain Text · Page Should Not Contain Element · Page Should Not Contain Text ·Pinch · Portrait · Press Keycode · Pull File · Pull Folder · Push File · Quit Application · Register Keyword To Run On Failure · Remove Application · Reset Application · Scroll · Scroll Down · Scroll Up · Set Appium Timeout ·Set Network Connection Status · Shake · Start Activity · Swipe · Swipe By Percent · Switch Application · Switch To Context · Tap · Text Should Be Visible · Wait Activity · Wait Until Element Is Visible · Wait Until Page Contains ·Wait Until Page Contains Element · Wait Until Page Does Not Contain · Wait Until Page Does Not Contain Element · Xpath Should Match X Times · Zoom
背景应用程序 · 捕获页面截图 · 明文 · 单击A点 · 单击按钮 · 单击元素 · 单击坐标时的元素 · 单击文本 · 关闭全部应用程序 · 关闭应用程序 · 元素属性应匹配 · 元素名称应为 · 元素应该被禁用 · 元素应该被启用 · 元素应该是可见的 · 元素应该包含文本 ·元素不该该包含文本 · 元素文本应该 · 元素值应该 · 获取活动 · 获取Appium SessionId · 获取Appium超时 · 得到能力 · 获取上下文 · 获取当前上下文 · 获取元素属性 · 获取元素位置 · 获取元素大小 · 获取匹配Xpath计数 · 获取网络链接状态 · 获取源 ·获取文本 · 获取Webelement · 获取Webelements · 获取窗口高度 · 获取窗口宽度 · 返回 · 转到URL · 隐藏键盘 · 输入密码 · 输入文本 · 输入值 · 安装应用 · 园林 · 启动应用程序 · 锁 · 日志源 · 长按 · 长按键码 · 打开应用 · 页面应包含元素 · 页面应包含文本 ·页面不该包含元素 · 页面不该包含文本 · 捏 · 肖像 · 按键码 · 拉文件 · 拉文件夹 · 按文件 · 退出应用程序 · 注册关键字上运行故障 · 删除应用程序 · 复位应用程序 · 滚动 · 向下滚动 · 向上滚动 · 设置Appium超时 · 设置网络链接状态 · 摇 · 启动活动 · 滑动 ·按百分比滑动 · 切换应用程序 · 切换到上下文 · 点击 · 文本应该可见 · 等待活动 · 等到元素可见 · 等到页面包含 · 等到页面包含元素 · 等到页面不包含 · 等待页面不包含元素 · Xpath应匹配X次 · 缩放
Keyword | Arguments | Documentation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Background App | seconds=5 | Puts the application in the background on the device for a certain duration. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Capture Page Screenshot | 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. css can be used to modify how the screenshot is taken. By default the bakground color is changed to avoid possible problems with background leaking when the page layout is somehow broken. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Clear Text | locator | Clears the text field identified by locator. See introduction for details about locating elements. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Click A Point | x=0, y=0,duration=100 | Click on a point |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Click Button | index_or_name | Click button |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Click Element | locator | Click element identified by locator. Key attributes for arbitrary elements are index and name. See introduction for details about locating elements. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Click Element At Coordinates | coordinate_X,coordinate_Y | click element at a certain coordinate |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Click Text | text,exact_match=False | Click text identified by By default tries to click first text involves given If there are multiple use of |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Close All Applications | 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. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Close Application | Closes the current application and also close webdriver session. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Element Attribute Should Match | locator, attr_name,match_pattern,regexp=False | Verify that an attribute of an element matches the expected criteria. The element is identified by locator. See introduction for details about locating elements. If more than one element matches, the first element is selected. The attr_name is the name of the attribute within the selected element. The match_pattern is used for the matching, if the match_pattern is
The regexp defines whether the string match is done using regular expressions (i.e. BuiltIn Library's Should Match Regexp or string pattern match (i.e. BuiltIn Library's Should Match) Examples:
1. is a string pattern match i.e. the 'text' attribute should end with the string 'foobar' 2. is a regular expression match i.e. the regexp 'f.*ar' should be within the 'text' attribute 3. is a boolead match i.e. the 'enabled' attribute should be True NOTE: On Android the supported attribute names are hard-coded in the AndroidElement Class's getBoolAttribute() and getStringAttribute() methods. Currently supported (appium v1.4.11): contentDescription, text, className, resourceId, enabled, checkable, checked, clickable, focusable, focused, longClickable, scrollable, selected, displayed NOTE: Some attributes can be evaluated in two different ways e.g. these evaluate the same thing:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Element Name Should Be | locator, expected | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Element Should Be Disabled | 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. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Element Should Be Enabled | 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. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Element Should Be Visible | 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 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Element Should Contain Text | locator, expected,message= | Verifies element identified by 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 New in AppiumLibrary 1.4. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Element Should Not Contain Text | locator, expected,message= | Verifies element identified by
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Element Text Should Be | locator, expected,message= | Verifies element identified by In contrast to Element Should Contain Text, this keyword does not try a substring match but an exact match on the element identified by
New in AppiumLibrary 1.4. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Element Value Should Be | locator, expected | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Activity | Retrieves the current activity on the device. Android only. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Appium SessionId | Returns the current session ID as a reference |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Appium Timeout | Gets the timeout in seconds that is used by various keywords. See Set Appium Timeout for an explanation. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Capability | capability_name | Return the desired capability value by desired capability name |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Contexts | Get available contexts. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Current Context | Get current context. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Element Attribute | locator, attribute | Get element attribute using given attribute: name, value,... Examples:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Element Location | locator | Get element location Key attributes for arbitrary elements are id and name. See introduction for details about locating elements. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Element Size | locator | Get element size Key attributes for arbitrary elements are id and name. See introduction for details about locating elements. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Matching Xpath Count | xpath | Returns number of elements matching One should not use the xpath= prefix for 'xpath'. XPath is assumed.
If you wish to assert the number of matching elements, use Xpath Should Match X Times. New in AppiumLibrary 1.4. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Network Connection Status | Returns an integer bitmask specifying the network connection type. Android only. See set network connection status for more details. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Source | Returns the entire source of the current page. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Text | locator | Get element text (for hybrid and mobile browser use xpath locator, others might cause problem) Example:
New in AppiumLibrary 1.4. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Webelement | locator | Returns the first WebElement object matching Example:
New in AppiumLibrary 1.4. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Webelements | locator | Returns list of WebElement objects matching Example:
This keyword was changed in AppiumLibrary 1.4 in following ways:
New in AppiumLibrary 1.4. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Window Height | Get current device height. Example:
New in AppiumLibrary 1.4.5 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Window Width | Get current device width. Example:
New in AppiumLibrary 1.4.5 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Go Back | Goes one step backward in the browser history. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Go To Url | url | Opens URL in default web browser. Example:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Hide Keyboard | key_name=None | Hides the software keyboard on the device. (optional) In iOS, use key_name to press a particular key, ex. Done. In Android, no parameters are used. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Input Password | 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. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Input Text | locator, text | Types the given text into text field identified by locator. See introduction for details about locating elements. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Input Value | locator, text | Sets the given value into text field identified by locator. This is an IOS only keyword, input value makes use of set_value See introduction for details about locating elements. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Install App | app_path,app_package | Install App via Appium Android only.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Landscape | Set the device orientation to LANDSCAPE |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Launch Application | Launch application. Application can be launched while Appium session running. This keyword can be used to launch application during test case or between test cases. This keyword works while Open Application has a test running. This is good practice to Launch Application and Quit Application between test cases. As Suite Setup is Open Application, Test Setup can be used to Launch Application Example (syntax is just a representation, refer to RF Guide for usage of Setup/Teardown):
See Quit Application for quiting application but keeping Appium sesion running. New in AppiumLibrary 1.4.6 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Lock | seconds=5 | Lock the device for a certain period of time. iOS only. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Log Source | loglevel=INFO | Logs and returns the entire html source of the current page or frame. The loglevel argument defines the used log level. Valid log levels are WARN, INFO (default), DEBUG, TRACE and NONE (no logging). |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Long Press | locator | Long press the element |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Long Press Keycode | keycode,metastate=None | Sends a long press of keycode to the device. Android only. See press keycode for more details. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Open Application | remote_url,alias=None,**kwargs | Opens a new application to given Appium server. Capabilities of appium server, Android and iOS, Please check http://appium.io/slate/en/master/?python#appium-server-capabilities
Examples:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Page Should Contain Element | locator,loglevel=INFO | Verifies that current page contains locator element. If this keyword fails, it automatically logs the page source using the log level specified with the optional loglevel argument. Giving NONE as level disables logging. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Page Should Contain Text | text,loglevel=INFO | Verifies that current page contains text. If this keyword fails, it automatically logs the page source using the log level specified with the optional loglevel argument. Giving NONE as level disables logging. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Page Should Not Contain Element | locator,loglevel=INFO | Verifies that current page not contains locator element. If this keyword fails, it automatically logs the page source using the log level specified with the optional loglevel argument. Giving NONE as level disables logging. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Page Should Not Contain Text | text,loglevel=INFO | Verifies that current page not contains text. If this keyword fails, it automatically logs the page source using the log level specified with the optional loglevel argument. Giving NONE as level disables logging. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Pinch | locator,percent=200%,steps=1 | Pinch in on an element a certain amount. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Portrait | Set the device orientation to PORTRAIT |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Press Keycode | keycode,metastate=None | Sends a press of keycode to the device. Android only. Possible keycodes & meta states can be found in http://developer.android.com/reference/android/view/KeyEvent.html Meta state describe the pressed state of key modifiers such as Shift, Ctrl & Alt keys. The Meta State is an integer in which each bit set to 1 represents a pressed meta key. For example
metastate=1 --> Shift is pressed metastate=2 --> Alt is pressed metastate=3 --> Shift+Alt is pressed
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Pull File | path,decode=False | Retrieves the file at path and return it's content. Android only.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Pull Folder | path,decode=False | Retrieves a folder at path. Returns the folder's contents zipped. Android only.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Push File | path, data,encode=False | Puts the data in the file specified as path. Android only.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Quit Application | Quit application. Application can be quit while Appium session is kept alive. This keyword can be used to close application during test case or between test cases. See Launch Application for an explanation. New in AppiumLibrary 1.4.6 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Register Keyword To Run On Failure | keyword | Sets the keyword to execute when a AppiumLibrary keyword fails. keyword_name is the name of a keyword (from any available libraries) that will be executed if a AppiumLibrary keyword fails. It is not possible to use a keyword that requires arguments. Using the value "Nothing" will disable this feature altogether. The initial keyword to use is set in importing, and the keyword that is used by default is Capture Page Screenshot. Taking a screenshot when something failed is a very useful feature, but notice that it can slow down the execution. This keyword returns the name of the previously registered failure keyword. It can be used to restore the original value later. Example:
This run-on-failure functionality only works when running tests on Python/Jython 2.4 or newer and it does not work on IronPython at all. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Remove Application | application_id | Removes the application that is identified with an application id Example:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Reset Application | Reset application. Open Application can be reset while Appium session is kept alive. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Scroll | start_locator,end_locator | Scrolls from one element to another Key attributes for arbitrary elements are id and name. See introduction for details about locating elements. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Scroll Down | locator | Scrolls down to element |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Scroll Up | locator | Scrolls up to element |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Set Appium Timeout | seconds | Sets the timeout in seconds used by various keywords. There are several Wait ... keywords that take timeout as an argument. All of these timeout arguments are optional. The timeout used by all of them can be set globally using this keyword. The previous timeout value is returned by this keyword and can be used to set the old value back later. The default timeout is 5 seconds, but it can be altered in importing. Example:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Set Network Connection Status | connectionStatus | Sets the network connection Status. Android only. Possible values:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Shake | Shake the device |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Start Activity | appPackage,appActivity, **opts | Opens an arbitrary activity during a test. If the activity belongs to another application, that application is started and the activity is opened. Android only.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Swipe | start_x, start_y,offset_x, offset_y,duration=1000 | Swipe from one point to another point, for an optional duration. Args:
Usage:
NOTE: Android 'Swipe' is not working properly, use |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Swipe By Percent | start_x, start_y,end_x, end_y,duration=1000 | Swipe from one percent of the screen to another percent, for an optional duration. Normal swipe fails to scale for different screen resolutions, this can be avoided using percent. Args:
Usage:
NOTE: This also considers swipe acts different between iOS and Android. New in AppiumLibrary 1.4.5 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Switch Application | index_or_alias | Switches the active application by index or alias. index_or_alias is either application index (an integer) or alias (a string). Index is got as the return value of Open Application. This keyword returns the index of the previous active application, which can be used to switch back to that application later. Example:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Switch To Context | context_name | Switch to a new context |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Tap | locator,x_offset=None,y_offset=None,count=1 | Tap element identified by Args:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Text Should Be Visible | text,exact_match=False,loglevel=INFO | Verifies that element identified with text is visible. New in AppiumLibrary 1.4.5 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Wait Activity | activity, timeout,interval=1 | Wait for an activity: block until target activity presents or time out. Android only.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Wait Until Element Is Visible | locator,timeout=None,error=None | Waits until element specified with locator is visible. Fails if timeout expires before the element is visible. See introduction for more information about timeout and its default value. error can be used to override the default error message. See also Wait Until Page Contains, Wait Until Page Contains Element, Wait For Condition and BuiltIn keyword Wait Until Keyword Succeeds. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Wait Until Page Contains | text,timeout=None,error=None | Waits until text appears on current page. Fails if timeout expires before the text appears. See introduction for more information about timeout and its default value. error can be used to override the default error message. See also Wait Until Page Does Not Contain, Wait Until Page Contains Element, Wait Until Page Does Not Contain Element and BuiltIn keyword Wait Until Keyword Succeeds. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Wait Until Page Contains Element | locator,timeout=None,error=None | Waits until element specified with locator appears on current page. Fails if timeout expires before the element appears. See introduction for more information about timeout and its default value. error can be used to override the default error message. See also Wait Until Page Contains, Wait Until Page Does Not Contain Wait Until Page Does Not Contain Element and BuiltIn keyword Wait Until Keyword Succeeds. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Wait Until Page Does Not Contain | text,timeout=None,error=None | Waits until text disappears from current page. Fails if timeout expires before the text disappears. See introduction for more information about timeout and its default value. error can be used to override the default error message. See also Wait Until Page Contains, Wait Until Page Contains Element, Wait Until Page Does Not Contain Element and BuiltIn keyword Wait Until Keyword Succeeds. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Wait Until Page Does Not Contain Element | locator,timeout=None,error=None | Waits until element specified with locator disappears from current page. Fails if timeout expires before the element disappears. See introduction for more information about timeout and its default value. error can be used to override the default error message. See also Wait Until Page Contains, Wait Until Page Does Not Contain, Wait Until Page Contains Element and BuiltIn keyword Wait Until Keyword Succeeds. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Xpath Should Match X Times | xpath, count,error=None,loglevel=INFO | Verifies that the page contains the given number of elements located by the given One should not use the xpath= prefix for 'xpath'. XPath is assumed.
See Log Source for explanation about New in AppiumLibrary 1.4. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Zoom | locator,percent=200%,steps=1 | Zooms in on an element a certain amount. |
图书馆版本: | 1.4.6 |
---|---|
图书馆范围: | 全球 |
命名参数: | 支持的 |
AppiumLibrary是Robot Framework的移动应用程序测试库。
AppiumLibrary中须要在页面上查找元素的全部关键字都接受一个参数,a locator
或a webelement
。locator
是一个字符串,描述如何使用指定不一样位置策略的语法来定位元素。webelement
是一个包含WebElement实例的变量,它是元素的表示形式。
默认状况下,当提供定位器时,它将与特定元素类型的键属性进行匹配。对于iOS和Android,key属性适用id
于全部元素,定位元素很容易使用id
。例如:
单击元素id = my_element
在AppiumLibrary 1.4中新增,id
而且xpath
不须要指定,可是xpath
应该以//
else 开头,只需使用xpath
定位器,以下所述。
例如:
单击元素my_element 等待页面包含元素// * [/ type="android.widget.EditText“]
Appium还支持一些Mobile JSON Wire Protocol定位器策略。也能够经过指定具备定位符前缀的查找策略来指定AppiumLibrary应该用于查找元素的方法。支持的策略是:
战略 | 例 | 描述 | 注意 |
识别码 | 单击元素| 标识符= my_element | 由@id属性匹配 | |
ID | 单击元素| ID = my_element | 匹配@ resource-id属性 | |
accessibility_id | 单击元素| accessibility_id = BUTTON3 | 辅助功能选项使用。 | |
XPath的 | 单击元素| 的xpath = // UIATableView / UIATableCell / UIAButton | 与任意XPath匹配 | |
类 | 单击元素| 类= UIAPickerWheel | 按类匹配 | |
安卓 | 单击元素| 机器人= UiSelector()。描述( '应用') | Android UI Automator匹配 | |
IOS | 单击元素| IOS = .buttons()。withName( '应用') | iOS UI Automation匹配 | |
CSS | 单击元素| CSS = .green_button | 在webview中经过css匹配 | |
名称 | 单击元素| 名称= my_element | 匹配@name属性 | 仅适用于Selendroid |
从AppiumLibrary的1.4版开始,能够传递包含WebElement而不是字符串定位符的参数。要获取WebElement,请使用新的Get WebElements或Get WebElement关键字。
例如:
@ {elements} Get Webelements class = UIAButton Click Element @ {elements} [2]
参数 | 文档 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
timeout = 5, run_on_failure =捕获页面截图 | 可使用可选参数导入AppiumLibrary。
默认状况下,Capture Page Screenshot将用于截取当前页面的屏幕截图。使用No Operation值将彻底禁用此功能。有关此功能的更多信息,请参阅注册关键字以运行失败关键字。 例子:
|
背景应用程序 · 捕获页面截图 · 明文 · 单击A点 · 单击按钮 · 单击元素 · 单击坐标时的元素 · 单击文本 · 关闭全部应用程序 · 关闭应用程序 · 元素属性应匹配 · 元素名称应为 · 元素应该被禁用 · 元素应该被启用 · 元素应该是可见的 · 元素应该包含文本 ·元素不该该包含文本 · 元素文本应该 · 元素值应该 · 获取活动 · 获取Appium SessionId · 获取Appium超时 · 得到能力 · 获取上下文 · 获取当前上下文 · 获取元素属性 · 获取元素位置 · 获取元素大小 · 获取匹配Xpath计数 · 获取网络链接状态 · 获取源 ·获取文本 · 获取Webelement · 获取Webelements · 获取窗口高度 · 获取窗口宽度 · 返回 · 转到URL · 隐藏键盘 · 输入密码 · 输入文本 · 输入值 · 安装应用 · 园林 · 启动应用程序 · 锁 · 日志源 · 长按 · 长按键码 · 打开应用 · 页面应包含元素 · 页面应包含文本 ·页面不该包含元素 · 页面不该包含文本 · 捏 · 肖像 · 按键码 · 拉文件 · 拉文件夹 · 按文件 · 退出应用程序 · 注册关键字上运行故障 · 删除应用程序 · 复位应用程序 · 滚动 · 向下滚动 · 向上滚动 · 设置Appium超时 · 设置网络链接状态 · 摇 · 启动活动 · 滑动 ·按百分比滑动 · 切换应用程序 · 切换到上下文 · 点击 · 文本应该可见 · 等待活动 · 等到元素可见 · 等到页面包含 · 等到页面包含元素 · 等到页面不包含 · 等待页面不包含元素 · Xpath应匹配X次 · 缩放
关键词 | 参数 | 文档 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
背景应用 | 秒= 5 | 将应用程序放在设备的后台一段时间。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
捕获页面截图 | 文件名=无 | 获取当前页面的屏幕截图并将其嵌入到日志中。 filename参数指定要将屏幕截图写入的文件的名称。若是没有给出文件名,屏幕截图将保存到写入Robot Framework日志文件的目录下的appium-screenshot- <counter> .png文件中。该文件名,若是它不是以绝对格式给出也被认为是相对于同一目录。 css可用于修改屏幕截图的截取方式。默认状况下,更改bakground颜色以免在页面布局以某种方式损坏时可能出现背景泄漏问题。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
明文 | 定位器 | 清除定位器标识的文本字段。 有关定位元素的详细信息,请参阅简介。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
单击A Point | x = 0, y = 0, 持续时间= 100 | 点击一个点 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
单击按钮 | index_or_name | 点击按钮 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
单击元素 | 定位器 | 单击定位器标识的元素。 任意元素的关键属性是索引和名称。有关定位元素的详细信息,请参阅简介。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
单击坐标处的元素 | coordinate_X, coordinate_Y | 单击某个坐标处的元素 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
单击文本 | text, exact_match = False | 单击标识的文本 默认状况下,尝试单击第一个文本涉及给定 若是有屡次使用 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
关闭全部应用程序 | 关闭全部打开的应用程序。 此关键字旨在用于测试或套件拆解,以确保在测试执行完成以前关闭全部应用程序。 在此关键字以后,Open Application返回的应用程序索引将重置并从1开始。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
关闭申请 | 关闭当前应用程序并关闭webdriver会话。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
元素属性应该匹配 | locator, attr_name,match_pattern, regexp = False | 验证元素的属性是否与预期条件匹配。 该元素由定位器标识。有关定位元素的详细信息,请参阅简介。若是多个元素匹配,则选择第一个元素。 该attr_name是选定的元素中的属性的名称。 若是match_pattern是匹配,match_pattern用于匹配
在正则表达式定义字符串是否匹配使用正则表达式完成(即内置的图书馆应该匹配的正则表达式或字符串模式匹配(即内置的图书馆应该匹配) 例子:
1.是一个字符串模式匹配,即'text'属性应该以字符串'foobar'结尾 2.是一个正则表达式匹配,即正则表达式'f。* ar'应该在'text'属性中 3.是一个boolead匹配即'enabled'属性应为True 注意:在Android上,支持的属性名称在 AndroidElement类的getBoolAttribute()和getStringAttribute()方法中进行了硬编码。目前支持(appium v1.4.11): contentDescription,text,className,resourceId,enabled,checkable,checked,clickable,focusable,focused,longClickable,scrollable,selected,displayed 注意:某些属性能够经过两种不一样的方式进行评估,例如:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
元素名称应该是 | 定位器, 预期 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
元素应该被禁用 | locator, loglevel = INFO | 验证已使用定位器标识的元素已禁用。 任意元素的关键属性是id和name。有关定位元素的详细信息,请参阅简介。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
应该启用元素 | locator, loglevel = INFO | 验证是否已启用使用定位器标识的元素。 任意元素的关键属性是id和name。有关定位元素的详细信息,请参阅简介。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
元素应该是可见的 | locator, loglevel = INFO | 验证使用定位器标识的元素是否可见。 任意元素的关键属性是id和name。有关定位元素的详细信息,请参阅简介。 AppiumLibrary 1.4.5中的新功能 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
元素应包含文本 | locator, expected,message = | 验证由 若是您但愿在元素的文本上断言精确(非子串)匹配,请使用元素文本。 任意元素的关键属性是 AppiumLibrary 1.4中的新功能。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
元素不该包含文本 | locator, expected,message = | 验证标识的元素
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
元素文本应该是 | locator, expected,message = | 验证由 与Element Should Contain Text相比,此关键字不会尝试子字符串匹配,而是在标识的元素上进行精确匹配
AppiumLibrary 1.4中的新功能。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
要素值应该是 | 定位器, 预期 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
获取活动 | 检索设备上的当前活动。 仅适用于Android。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
获取Appium SessionId | 返回当前会话ID做为参考 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
获取Appium超时 | 获取各类关键字使用的超时(以秒为单位)。 有关说明,请参阅设置Appium超时。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
得到能力 | capability_name | 按所需的功能名称返回所需的功能值 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
获取上下文 | 获取可用的上下文。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
获取当前上下文 | 获取当前上下文。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
获取元素属性 | 定位器, 属性 | 使用给定属性获取元素属性:name,value,... 例子:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
获取元素位置 | 定位器 | 获取元素位置 任意元素的关键属性是id和name。有关定位元素的详细信息,请参阅简介。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
获取元素大小 | 定位器 | 获取元素大小 任意元素的关键属性是id和name。有关定位元素的详细信息,请参阅简介。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
获取匹配的Xpath计数 | XPath的 | 返回匹配的元素数 不该该为'xpath' 使用xpath =前缀。假设XPath。
若是您但愿断言匹配元素的数量,请使用Xpath应匹配X次。 AppiumLibrary 1.4中的新功能。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
获取网络链接状态 | 返回指定网络链接类型的整数位掩码。 仅适用于Android。 有关详细信息,请参阅设置网络链接状态 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
获取来源 | 返回当前页面的整个源。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
获取文字 | 定位器 | 获取元素文本(对于混合和移动浏览器使用xpath定位器,其余可能会致使问题) 例:
AppiumLibrary 1.4中的新功能。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
获得Webelement | 定位器 | 返回第一个匹配的WebElement对象 例:
AppiumLibrary 1.4中的新功能。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
得到Webelements | 定位器 | 返回匹配的WebElement对象列表 例:
此关键字在AppiumLibrary 1.4中如下列方式更改:
AppiumLibrary 1.4中的新功能。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
得到窗口高度 | 获取当前设备高度。 例:
AppiumLibrary 1.4.5中的新功能 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
获取窗口宽度 | 获取当前设备宽度。 例:
AppiumLibrary 1.4.5中的新功能 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
回去 | 在浏览器历史记录中向后退一步。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
转到网址 | 网址 | 在默认Web浏览器中打开URL。 例:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
隐藏键盘 | KEY_NAME =无 | 隐藏设备上的软件键盘。(可选)在iOS中,使用key_name按特定键,例如。完成。在Android中,不使用任何参数。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
输入密码 | 定位器, 文本 | 将给定密码键入由locator标识的文本字段。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
输入文本 | 定位器, 文本 | 将给定文本键入由定位符标识的文本字段。 有关定位元素的详细信息,请参阅简介。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
输入值 | 定位器, 文本 | 将给定值设置为locator标识的文本字段。这是一个仅限IOS的关键字,输入值使用set_value 有关定位元素的详细信息,请参阅简介。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
安装应用程序 | app_path, app_package | 经过Appium安装App 仅适用于Android。
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
景观 | 将设备方向设置为LANDSCAPE |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
启动程序 | 启动程序。应用程序能够在Appium会话运行时启动。此关键字可用于在测试用例期间或测试用例之间启动应用程序。 当Open Application运行测试时,此关键字有效。这是在测试用例之间启动应用程序和退出应用程序的好习惯。因为Suite Setup是Open Application,所以可使用Test Setup 启动应用程序 示例(语法只是一种表示,请参阅RF指南以了解Setup / Teardown的用法):
请参阅退出应用程序以退出应用程序但保持Appium sesion运行。 AppiumLibrary 1.4.6中的新功能 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
锁 | 秒= 5 | 将设备锁定一段时间。仅适用于iOS。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
日志源 | 记录等级= INFO | 记录并返回当前页面或框架的整个html源。 该日志级别参数定义所使用的日志级别。有效的日志级别为WARN,INFO(默认),DEBUG,TRACE和NONE(无日志记录)。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
长按 | 定位器 | 长按元素 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
长按键码 | keycode, metastate =无 | 向设备发送长按键代码。 仅适用于Android。 有关详细信息,请参阅按键代码。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
开放申请 | remote_url, alias = None,** kwargs | 打开给定Appium服务器的新应用程序。appium服务器,Android和iOS的功能,请查看http://appium.io/slate/en/master/?python#appium-server-capabilities
例子:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
页面应包含元素 | locator, loglevel = INFO | 验证当前页面是否包含locator元素。 若是此关键字失败,它将使用使用可选loglevel参数指定的日志级别自动记录页面源。将NONE做为级别禁用日志记录。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
页面应包含文本 | text, loglevel = INFO | 验证当前页面是否包含文本。 若是此关键字失败,它将使用使用可选loglevel参数指定的日志级别自动记录页面源。将NONE做为级别禁用日志记录。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
页面不该包含元素 | locator, loglevel = INFO | 验证当前页面不包含locator元素。 若是此关键字失败,它将使用使用可选loglevel参数指定的日志级别自动记录页面源。将NONE做为级别禁用日志记录。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
页面不该包含文本 | text, loglevel = INFO | 验证当前页面不包含文本。 若是此关键字失败,它将使用使用可选loglevel参数指定的日志级别自动记录页面源。将NONE做为级别禁用日志记录。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
捏 | locator, percent = 200%,steps = 1 | 捏必定量的元素。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
肖像 | 将设备方向设置为PORTRAIT |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
按键码 | keycode, metastate =无 | 向设备发送按键代码。 仅适用于Android。 能够在http://developer.android.com/reference/android/view/KeyEvent.html中找到可能的密钥代码和元状态。 Meta状态描述按键修改器的按下状态,例如Shift,Ctrl和Alt键。Meta State是一个整数,其中每一个设置为1的位表示按下的元键。 例如
metastate = 1 - > Shift被按下 metastate = 2 - > Alt被按下 metastate = 3 - >按下Shift + Alt
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
拉文件 | path, decode = False | 在路径中检索文件并返回其内容。 仅适用于Android。
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
拉文件夹 | path, decode = False | 检索路径中的文件夹。返回压缩文件夹的内容。 仅适用于Android。
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
推送文件 | path, data, encode = False | 将数据放在指定为path的文件中。 仅适用于Android。
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
退出申请 | 退出申请。Appium会话保持活动状态时,应用程序能够退出。此关键字可用于在测试用例期间或测试用例之间关闭应用程序。 请参阅启动应用程序以获取解释 AppiumLibrary 1.4.6中的新功能 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
注册关键字以在失败时运行 | 关键词 | 设置关键字在AppiumLibrary关键字失败时执行。 keyword_name是在AppiumLibrary关键字失败时将执行的关键字(来自任何可用库)的名称。没法使用须要参数的关键字。使用值“Nothing”将彻底禁用此功能。 要使用的初始关键字是在导入中设置的,默认状况下使用的关键字是Capture Page Screenshot。在出现故障时拍摄屏幕截图是一个很是有用的功能,但请注意它能够减慢执行速度。 此关键字返回先前注册的失败关键字的名称。它能够用于之后恢复原始值。 例:
这种运行失败功能仅在Python / Jython 2.4或更高版本上运行测试时才有效,并且根本不适用于IronPython。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
删除申请 | APPLICATION_ID | 删除使用应用程序ID标识的应用程序 例:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
重置申请 | 重置申请。Appium会话保持活动状态时,能够重置打开应用程序。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
滚动 | start_locator, end_locator | 从一个元素滚动到另外一个元素任意元素的键属性是id和name。有关定位元素的详细信息,请参阅简介。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
向下滚动 | 定位器 | 向下滚动到元素 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
向上滑动 | 定位器 | 向上滚动到元素 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
设置Appium超时 | 秒 | 设置各类关键字使用的超时秒数。 有几个Wait ...关键字以超时做为参数。全部这些超时参数都是可选的。可使用此关键字全局设置全部这些超时使用的超时。 此关键字返回先前的超时值,可用于稍后设置旧值。默认超时为5秒,但能够在导入时更改。 例:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
设置网络链接状态 | connectionStatus | 设置网络链接状态。 仅适用于Android。 可能的值:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
摇 | 摇晃设备 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
开始活动 | appPackage, appActivity,**选择 | 在测试期间打开任意活动。若是活动属于另外一个应用程序,则启动该应用程序并打开活动。 仅适用于Android。
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
刷卡 | start_x, start_y, offset_x,offset_y, duration = 1000 | 可选持续时间从一个点滑动到另外一个点。 ARGS:
用法:
注意: Android'Swipe'没法正常工做,请使用 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
按百分比滑动 | start_x, start_y, end_x,end_y, duration = 1000 | 可选持续时间从屏幕的百分比滑动到另外一个百分比。普通滑动没法针对不一样的屏幕分辨率进行缩放,这可使用百分比来避免。 ARGS:
用法:
注意:这也考虑了iOS和Android之间不一样的滑动行为。 AppiumLibrary 1.4.5中的新功能 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
切换应用 | index_or_alias | 按索引或别名切换活动应用程序。 index_or_alias是应用程序索引(整数)或别名(字符串)。获取索引做为Open Application的返回值。 此关键字返回上一个活动应用程序的索引,该索引可用于稍后切换回该应用程序。 例:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
切换到上下文 | CONTEXT_NAME | 切换到新的上下文 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
龙头 | locator, x_offset = None,y_offset = None, count = 1 | 点击标识的元素 ARGS:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
文字应该是可见的 | text, exact_match = False,loglevel = INFO | 验证用文本标识的元素是否可见。 AppiumLibrary 1.4.5中的新功能 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
等待活动 | 活动, 超时, 间隔= 1 | 等待活动:阻止直到目标活动出现或超时。 仅适用于Android。
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
等到元素可见 | locator, timeout =无, 错误=无 | 等待直到使用定位器指定的元素可见。 若是超时在元素可见以前到期,则失败。有关超时及其默认值的更多信息,请参阅简介。 错误可用于覆盖默认错误消息。 另请参阅等待直到页面包含,等待直到页面包含元素,等待条件和BuiltIn关键字等待直到关键字成功。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
等到页面包含 | text, timeout = None,error = None | 等待文本出如今当前页面上。 若是超时在文本出现以前到期,则会失败。有关超时及其默认值的更多信息,请参阅简介。 错误可用于覆盖默认错误消息。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
等到页面包含元素 | locator, timeout =无, 错误=无 | 等待直到使用定位器指定的元素出如今当前页面上。 若是超时在元素出现以前到期,则失败。有关超时及其默认值的更多信息,请参阅简介。 错误可用于覆盖默认错误消息。 另请参阅等待直到页面包含,等到页面不包含 等待直到页面不包含元素和BuiltIn关键字等待直到关键字成功。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
等到页面不包含 | text, timeout = None,error = None | 等待文本从当前页面消失。 若是超时在文本消失以前到期,则失败。有关超时及其默认值的更多信息,请参阅简介。 错误可用于覆盖默认错误消息。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
等到页面不包含元素 | locator, timeout =无, 错误=无 | 等待直到使用定位器指定的元素从当前页面消失。 若是超时在元素消失以前到期,则失败。有关超时及其默认值的更多信息,请参阅简介。 错误可用于覆盖默认错误消息。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Xpath应该匹配X次 | xpath, count, error = None, loglevel = INFO | 验证页面是否包含给定的给定数量的元素 不该该为'xpath' 使用xpath =前缀。假设XPath。
有关参数的说明,请参见日志源 AppiumLibrary 1.4中的新功能。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
放大 | locator, percent = 200%,steps = 1 | 放大必定数量的元素。 |
共有85个关键字。
由Libdoc于2017-10-30 01:55:33 生成。