Note: You are looking at a static snapshot of documentation related to Robot Framework automations. The most recent documentation is at https://robocorp.com/docs

Appium

Activates the application if it is not running or is running in the background. Args:

Arguments

ArgumentTypeDefault value
app_idnull
  • app_id - BundleId for iOS. Package name for Android.

New in AppiumLibrary v2

DEPRECATED!! use Background Application instead. Puts the application in the background on the device for a certain duration.

Arguments

ArgumentTypeDefault value
seconds5

Puts the application in the background on the device for a certain duration.

Arguments

ArgumentTypeDefault value
seconds5

Takes a screenshot of the current page and embeds it into the log.

Arguments

ArgumentTypeDefault value
filenameNone

filename argument specifies the name of the file to write the screenshot into. If no filename is given, the screenshot will be embedded as Base64 image to the log.html. In this case no file is created in the filesystem.

Warning: this behavior is new in 1.7. Previously if no filename was given the screenshots where stored as separate files named appium-screenshot-<counter>.png

Clears the text field identified by locator.

Arguments

ArgumentTypeDefault value
locatornull

See introduction for details about locating elements.

DEPRECATED!! Since selenium v4, use other keywords.

Arguments

ArgumentTypeDefault value
x0
y0
duration100

Click on a point

DEPRECATED!! in selenium v4, use Click Element keyword. Click button

Arguments

ArgumentTypeDefault value
index_or_namenull

Click element identified by locator.

Arguments

ArgumentTypeDefault value
locatornull

Key attributes for arbitrary elements are index and name. See introduction for details about locating elements.

DEPRECATED!! Since selenium v4, use other keywords.

Arguments

ArgumentTypeDefault value
coordinate_Xnull
coordinate_Ynull

click element at a certain coordinate

Click text identified by text.

Arguments

ArgumentTypeDefault value
textnull
exact_matchFalse

By default tries to click first text involves given text, if you would like to click exactly matching text, then set exact_match to True.

If there are multiple use of text and you do not want first one, use locator with Get Web Elements instead.

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.

Closes the current application and also close webdriver session.

Delete the file specified as path.

Arguments

ArgumentTypeDefault value
pathnull
timeout5000
include_stderrTrue

Android only.

  • path - the path on the device
  • timeout - delete command timeout
  • includeStderr - whether exception will be thrown if the command's return code is not zero

TO BE IMPLEMENTED Refer to : appium.webdriver.extensions.action_helpers

Verify that an attribute of an element matches the expected criteria.

Arguments

ArgumentTypeDefault value
locatornull
attr_namenull
match_patternnull
regexpFalse

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

  • boolean or 'True'/'true'/'False'/'false' String then a boolean match is applied
  • any other string is cause a string match

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:

Element Attribute Should Matchxpath = //*[contains(@text,'foo')]text*foobar
Element Attribute Should Matchxpath = //*[contains(@text,'foo')]textf.*arregexp = True
Element Attribute Should Matchxpath = //*[contains(@text,'foo')]enabledTrue
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 Attribute Should Matchxpath = //*[contains(@text,'example text')]nametxt_field_name
Element Name Should Bexpath = //*[contains(@text,'example text')]txt_field_name

Arguments

ArgumentTypeDefault value
locatornull
expectednull

Verifies that element identified with locator is disabled.

Arguments

ArgumentTypeDefault value
locatornull
loglevelINFO

Key attributes for arbitrary elements are id and name. See introduction for details about locating elements.

Verifies that element identified with locator is enabled.

Arguments

ArgumentTypeDefault value
locatornull
loglevelINFO

Key attributes for arbitrary elements are id and name. See introduction for details about locating elements.

Verifies that element identified with locator is visible.

Arguments

ArgumentTypeDefault value
locatornull
loglevelINFO

Key attributes for arbitrary elements are id and name. See introduction for details about locating elements.

New in AppiumLibrary 1.4.5

Verifies element identified by locator contains text expected.

Arguments

ArgumentTypeDefault value
locatornull
expectednull
message

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.

Verifies element identified by locator does not contain text expected.

Arguments

ArgumentTypeDefault value
locatornull
expectednull
message

message can be used to override the default error message. See Element Should Contain Text for more details.

Verifies element identified by locator exactly contains text expected.

Arguments

ArgumentTypeDefault value
locatornull
expectednull
message

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.

Arguments

ArgumentTypeDefault value
locatornull
expectednull

Execute ADB shell commands

Arguments

ArgumentTypeDefault value
commandnull
argsnull

Android only.

  • command - The ABD shell command
  • args - Arguments to send to command

Returns the exit code of ADB shell.

Requires server flag --relaxed-security to be set on Appium server.

Execute ADB shell commands

Arguments

ArgumentTypeDefault value
commandnull
timeoutnull
argsnull

Android only.

  • command - The ABD shell command
  • timeout - Timeout to be applied to command
  • args - Arguments to send to command

Returns the exit code of ADB shell.

Requires server flag --relaxed-security to be set on Appium server.

Inject a snippet of Async-JavaScript into the page for execution in the context of the currently selected frame (Web context only).

Arguments

ArgumentTypeDefault value
scriptnull
kwargsnull

The executed script is assumed to be asynchronous and must signal that is done by invoking the provided callback, which is always provided as the final argument to the function.

The value to this callback will be returned to the client.

Check Execute Script for example kwargs usage

Updated in AppiumLibrary 2

Execute a variety of native, mobile commands that aren't associated with a specific endpoint. See Appium Mobile Command for more details.

Arguments

ArgumentTypeDefault value
scriptnull
kwargsnull

Usage

&{scrollGesture}create dictionaryleft=${50}top=${150}width=${50}height=${200}direction=downpercent=${100}
Sleep1
Execute Scriptmobile: scrollGesture&{scrollGesture}

Updated in AppiumLibrary 2

Flick from one point to another point.

Arguments

ArgumentTypeDefault value
start_xintnull
start_yintnull
end_xintnull
end_yintnull

Args:

  • start_x - x-coordinate at which to start
  • start_y - y-coordinate at which to start
  • end_x - x-coordinate at which to stop
  • end_y - y-coordinate at which to stop

Usage:

Flick100100100400# Flicks the screen up.

Retrieves the current activity on the device.

Android only.

Returns the current session ID as a reference

Gets the timeout in seconds that is used by various keywords.

See Set Appium Timeout for an explanation.

Return the desired capability value by desired capability name

Arguments

ArgumentTypeDefault value
capability_namenull

Get available contexts.

Get current context.

Get element attribute using given attribute: name, value,...

Arguments

ArgumentTypeDefault value
locatornull
attributenull

Examples:

Get Element Attributelocatorname
Get Element Attributelocatorvalue

Get element location

Arguments

ArgumentTypeDefault value
locatornull

Key attributes for arbitrary elements are id and name. See introduction for details about locating elements.

Gets dimensions and coordinates of an element

Arguments

ArgumentTypeDefault value
locatornull

Key attributes for arbitrary elements are id and name. See introduction for details about locating elements.

Get element size

Arguments

ArgumentTypeDefault value
locatornull

Key attributes for arbitrary elements are id and name. See introduction for details about locating elements.

Returns number of elements matching xpath

Arguments

ArgumentTypeDefault value
xpathnull

One should not use the xpath= prefix for 'xpath'. XPath is assumed.

Correct:
${count}Get Matching Xpath Count//android.view.View[@text='Test']
Incorrect:
${count}Get Matching Xpath Countxpath=//android.view.View[@text='Test']

If you wish to assert the number of matching elements, use Xpath Should Match X Times.

New in AppiumLibrary 1.4.

Returns an integer bitmask specifying the network connection type.

Android only.

See set network connection status for more details.

Returns the entire source of the current page.

Get element text (for hybrid and mobile browser use xpath locator, others might cause problem)

Arguments

ArgumentTypeDefault value
locatornull

Usage

${text}Get Text//*[contains(@text,'foo')]

New in AppiumLibrary 1.4.

Returns the first WebElement object matching locator.

Arguments

ArgumentTypeDefault value
locatornull

Usage

${element}Get Webelementid=my_element
Click Element${element}

New in AppiumLibrary 1.4.

Returns a single WebElement objects matching locator that is a child of argument element.

Arguments

ArgumentTypeDefault value
elementnull
locatornull

This is useful when your HTML doesn't properly have id or name elements on all elements. So the user can find an element with a tag and then search that elmements children.

Returns list of WebElement objects matching locator.

Arguments

ArgumentTypeDefault value
locatornull

Usage

@{elements}Get Webelementsid=my_element
Click Element@{elements}[2]

This keyword was changed in AppiumLibrary 1.4 in following ways:

  • Name is changed from Get Elements to current one.
  • Deprecated argument fail_on_error, use Run Keyword and Ignore Error if necessary.

New in AppiumLibrary 1.4.

Get current device height.

Usage

${width}Get Window Width
${height}Get Window Height
Click A Point${width}${height}

New in AppiumLibrary 1.4.5

Get the current Webview window title.

Get the current Webview window URL.

Get current device width.

Usage

${width}Get Window Width
${height}Get Window Height
Click A Point${width}${height}

New in AppiumLibrary 1.4.5

Get available Webview windows.

Goes one step backward in the browser history.

Opens URL in default web browser.

Arguments

ArgumentTypeDefault value
urlnull

Usage

Open Applicationhttp://localhost:4755/wd/hubplatformName=iOSplatformVersion=7.0deviceName='iPhone Simulator'browserName=Safari
Go To URLhttp://m.webapp.com

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.

Arguments

ArgumentTypeDefault value
key_nameNone

Types the given password into text field identified by locator.

Arguments

ArgumentTypeDefault value
locatornull
textnull

Difference between this keyword and Input Text is that this keyword does not log the given password. See introduction for details about locating elements.

Types the given text into text field identified by locator.

Arguments

ArgumentTypeDefault value
locatornull
textnull

See introduction for details about locating elements.

Types the given text into currently selected text field.

Arguments

ArgumentTypeDefault value
textnull

Android only.

Sets the given value into text field identified by locator. This is an IOS only keyword, input value makes use of set_value

Arguments

ArgumentTypeDefault value
locatornull
textnull

See introduction for details about locating elements.

Install App via Appium

Arguments

ArgumentTypeDefault value
app_pathnull
app_packagenull

Android only.

  • app_path - path to app
  • app_package - package of install app to verify

Return true if Android keyboard is displayed or False if not displayed No parameters are used.

Set the device orientation to LANDSCAPE

DEPRECATED!! in selenium v4, use Activate Application keyword.

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):

[Setup Suite]
Open Applicationhttp://localhost:4723/wd/hubplatformName=AndroiddeviceName=192.168.56.101:5555app=${CURDIR}/demoapp/OrangeDemoApp.apk
[Test Setup]
Launch Application
<<<test execution>>>
<<<test execution>>>
[Test Teardown]
Quit Application
[Suite Teardown]
Close Application

See Quit Application for quiting application but keeping Appium sesion running.

Lock the device for a certain period of time. iOS only.

Arguments

ArgumentTypeDefault value
seconds5

Logs and returns the entire html source of the current page or frame.

Arguments

ArgumentTypeDefault value
loglevelINFO

The loglevel argument defines the used log level. Valid log levels are WARN, INFO (default), DEBUG, TRACE and NONE (no logging).

DEPRECATED!! Since selenium v4, use other keywords.

Arguments

ArgumentTypeDefault value
locatornull
duration1000

Long press the element with optional duration

Sends a long press of keycode to the device.

Arguments

ArgumentTypeDefault value
keycodenull
metastateNone

Android only.

See press keycode for more details.

Opens a new application to given Appium server. Capabilities of appium server, Android and iOS, Please check https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/server-args.md

Arguments

ArgumentTypeDefault value
remote_urlnull
aliasNone
kwargsnull
OptionMan.Description
remote_urlYesAppium server url
aliasnoalias
strict_sslNoallows you to send commands to an invalid certificate host like a self-signed one.

Examples:

Open Applicationhttp://localhost:4723/wd/hubalias=Myapp1platformName=iOSplatformVersion=7.0deviceName='iPhone Simulator'app=your.app
Open Applicationhttp://localhost:4723/wd/hubalias=Myapp1platformName=iOSplatformVersion=7.0deviceName='iPhone Simulator'app=your.appstrict_ssl=False
Open Applicationhttp://localhost:4723/wd/hubplatformName=AndroidplatformVersion=4.2.2deviceName=192.168.56.101:5555app=${CURDIR}/demoapp/OrangeDemoApp.apkappPackage=com.netease.qa.orangedemoappActivity=MainActivity

Opens and expands an Android device's notification drawer.

Android only.

Verifies that current page contains locator element.

Arguments

ArgumentTypeDefault value
locatornull
loglevelINFO

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.

Verifies that current page contains text.

Arguments

ArgumentTypeDefault value
textnull
loglevelINFO

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.

Verifies that current page not contains locator element.

Arguments

ArgumentTypeDefault value
locatornull
loglevelINFO

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.

Verifies that current page not contains text.

Arguments

ArgumentTypeDefault value
textnull
loglevelINFO

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.

DEPRECATED!! use Execute Script instead. Pinch in on an element a certain amount.

Arguments

ArgumentTypeDefault value
locatornull
percent200%
steps1

Set the device orientation to PORTRAIT

Sends a press of keycode to the device.

Arguments

ArgumentTypeDefault value
keycodenull
metastateNone

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

  • META_SHIFT_ON = 1
  • META_ALT_ON = 2
metastate=1 --> Shift is pressed metastate=2 --> Alt is pressed metastate=3 --> Shift+Alt is pressed
  • _keycode- - the keycode to be sent to the device
  • _metastate- - status of the meta keys

Retrieves the file at path and return it's content.

Arguments

ArgumentTypeDefault value
pathnull
decodeFalse

Android only.

  • path - the path to the file on the device
  • decode - True/False decode the data (base64) before returning it (default=False)

Retrieves a folder at path. Returns the folder's contents zipped.

Arguments

ArgumentTypeDefault value
pathnull
decodeFalse

Android only.

  • path - the path to the folder on the device
  • decode - True/False decode the data (base64) before returning it (default=False)

Puts the data in the file specified as path.

Arguments

ArgumentTypeDefault value
pathnull
datanull
encodeFalse

Android only.

  • path - the path on the device
  • data - data to be written to the file
  • encode - True/False encode the data as base64 before writing it to the file (default=False)

DEPRECATED!! in selenium v4, check Close Application keyword.

Close 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.

Sets the keyword to execute when a AppiumLibrary keyword fails.

Arguments

ArgumentTypeDefault value
keywordnull

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.

Usage

Register Keyword To Run On FailureLog Source# Run Log Source on failure.
${previous kw}=Register Keyword To Run On FailureNothing# Disables run-on-failure functionality and stores the previous kw name in a variable.
Register Keyword To Run On Failure${previous kw}# Restore to the previous keyword.

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.

Removes the application that is identified with an application id

Arguments

ArgumentTypeDefault value
application_idnull

Usage

Remove Applicationcom.netease.qa.orangedemo

DEPRECATED!! in selenium v4, check Terminate Application keyword.

Reset application. Open Application can be reset while Appium session is kept alive.

Scrolls from one element to another Key attributes for arbitrary elements are id and name. See introduction for details about locating elements.

Arguments

ArgumentTypeDefault value
start_locatornull
end_locatornull

Scrolls an element from given locator into view. Arguments:

Arguments

ArgumentTypeDefault value
locatornull
  • locator: The locator to find requested element. Key attributes for arbitrary elements are id and name. See introduction for details about locating elements.

Examples:

Scroll Element Into Viewcss=div.class

Sets the timeout in seconds used by various keywords.

Arguments

ArgumentTypeDefault value
secondsnull

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.

Usage

${orig timeout} =Set Appium Timeout15 seconds
Open page that loads slowly
Set Appium Timeout${orig timeout}

Set location

Arguments

ArgumentTypeDefault value
latitudenull
longitudenull
altitude10
  • latitute
  • longitude
  • altitude = 10 [optional]

Android only. New in AppiumLibrary 1.5

Sets the network connection Status.

Arguments

ArgumentTypeDefault value
connectionStatusnull

Android only.

Possible values:

ValueAliasDataWifiAirplane Mode
0(None)000
1(Airplane Mode)001
2(Wifi only)010
4(Data only)100
6(All network on)110

Shake the device

Opens an arbitrary activity during a test. If the activity belongs to another application, that application is started and the activity is opened.

Arguments

ArgumentTypeDefault value
appPackagenull
appActivitynull
optsnull

Android only.

  • appPackage - The package containing the activity to start.
  • appActivity - The activity to start.
  • appWaitPackage - Begin automation after this package starts (optional).
  • appWaitActivity - Begin automation after this activity starts (optional).
  • intentAction - Intent to start (opt_ional).
  • intentCategory - Intent category to start (optional).
  • intentFlags - Flags to send to the intent (optional).
  • optionalIntentArguments - Optional arguments to the intent (optional).
  • dontStopAppOnReset - Should the app be stopped on reset (optional)?

Starts an asynchronous Screen Recording for the current open application.

Arguments

ArgumentTypeDefault value
timeLimit180s
optionsnull

timeLimit sets the actual time limit of the recorded video.

  • The default value for both iOS and Android is 180 seconds (3 minutes).
  • The maximum value for Android is 3 minutes.
  • The maximum value for iOS is 10 minutes.

Optional Args

  • bitRate (Android Only) The video bit rate for the video, in megabits per second. 4 Mbp/s(4000000) is by default for Android API level below 27. 20 Mb/s(20000000) for API level 27 and above.
  • videoSize (Android Only) The format is widthxheight. The default value is the device's native display resolution (if supported), 1280x720 if not. For best results, use a size supported by your device's Advanced Video Coding (AVC) encoder. For example, "1280x720"
  • bugReport (Android Only) Set it to true in order to display additional information on the video overlay, such as a timestamp, that is helpful in videos captured to illustrate bugs. This option is only supported since API level 27 (Android O).
  • videoQuality (iOS Only) The video encoding quality (low, medium, high, photo - defaults to medium).
  • videoFps (iOS Only) The Frames Per Second rate of the recorded video. Change this value if the resulting video is too slow or too fast. Defaults to 10. This can decrease the resulting file size.
  • videoScale (iOS Only) The scaling value to apply. Read https://trac.ffmpeg.org/wiki/Scaling for possible values. Example value of 720p scaling is '1280:720'. This can decrease/increase the resulting file size. No scale is applied by default.

Start Screen Recording is used hand in hand with Stop Screen Recording. See Stop Screen Recording for more details. Example:

Start Screen Recording# starts a screen record session
.... keyword actions
Stop Screen Recordingfilename=output# saves the recorded session

Stop the given app on the device

Arguments

ArgumentTypeDefault value
app_idnull
timeout5000
include_stderrTrue

Android only. New in AppiumLibrary v2

Gathers the output from the previously started screen recording to a media file, then embeds it to the log.html(Android Only).

Arguments

ArgumentTypeDefault value
filenameNone
optionsnull

Requires an active or exhausted Screen Recording Session. See Start Screen Recording for more details.

Optional Args

  • remotePath The path to the remote location, where the resulting video should be uploaded. The following protocols are supported http/https, ftp. Null or empty string value (the default setting) means the content of resulting file should be encoded as Base64 and passed as the endpoint response value. An exception will be thrown if the generated media file is too big to fit into the available process memory.
  • username The name of the user for the remote authentication.
  • password The password for the remote authentication.
  • method The http multipart upload method name. The PUT one is used by default.

Usage

Start Screen Recording# starts a screen record session
.... keyword actions
Stop Screen Recordingfilename=output# saves the recorded session

Swipe from one point to another point, for an optional duration.

Arguments

ArgumentTypeDefault value
start_xnull
start_ynull
offset_xnull
offset_ynull
duration1000

Args:

  • start_x - x-coordinate at which to start
  • start_y - y-coordinate at which to start
  • offset_x - x-coordinate distance from start_x at which to stop
  • offset_y - y-coordinate distance from start_y at which to stop
  • duration - (optional) time to take the swipe, in ms.

Usage:

Swipe50010010001000

NOTE: Android 'Swipe' is not working properly, use offset_x and offset_y as if these are destination points.

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.

Arguments

ArgumentTypeDefault value
start_xnull
start_ynull
end_xnull
end_ynull
duration1000

Args:

  • start_x - x-percent at which to start
  • start_y - y-percent at which to start
  • end_x - x-percent distance from start_x at which to stop
  • end_y - y-percent distance from start_y at which to stop
  • duration - (optional) time to take the swipe, in ms.

Usage:

Swipe By Percent90501050# Swipes screen from right to left.

NOTE: This also considers swipe acts different between iOS and Android.

New in AppiumLibrary 1.4.5

Switches the active application by index or alias.

Arguments

ArgumentTypeDefault value
index_or_aliasnull

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.

Usage

${appium1}=Open Applicationhttp://localhost:4723/wd/hubalias=MyApp1platformName=iOSplatformVersion=7.0deviceName='iPhone Simulator'app=your.app
${appium2}=Open Applicationhttp://localhost:4755/wd/hubalias=MyApp2platformName=iOSplatformVersion=7.0deviceName='iPhone Simulator'app=your.app
Click ElementsendHello# Executed on appium running at localhost:4755
Switch Application${appium1}# Switch using index
Click ElementackHello# Executed on appium running at localhost:4723
Switch ApplicationMyApp2# Switch using alias
Page Should Contain TextackHello Received# Executed on appium running at localhost:4755

Switch to a new context

Arguments

ArgumentTypeDefault value
context_namenull

Switches focus to the specified frame, by index, name, or webelement.

Arguments

ArgumentTypeDefault value
framenull

Usage

Switch To Frame | iframe_name| Click Element | xpath=//*[@id="online-btn"] |

Switches focus to the parent context. If the current context is the top level browsing context, the context remains unchanged.

Switch to a new webview window if the application contains multiple webviews

Arguments

ArgumentTypeDefault value
window_namenull

DEPRECATED!! Since selenium v4, use Tap With Positions keyword.

Arguments

ArgumentTypeDefault value
locatornull
x_offsetNone
y_offsetNone
count1

Tap element identified by locator.

Args:

  • locator - (mandatory). Taps coordinates when set to ${None}.
  • x_offset - (optional) x coordinate to tap, relative to the top left corner of the element.
  • y_offset - (optional) y coordinate. If y is used, x must also be set, and vice versa
  • count - can be used for multiple times of tap on that element

Sends one or more taps with one or more touch points.iOS only.

Arguments

ArgumentTypeDefault value
locatornull
number_of_tapsnull
number_of_touchesnull

Args:

  • number_of_taps - The number of taps.
  • number_of_touches - The number of touch points.

Taps on a particular place with up to five fingers, holding for a certain time

Arguments

ArgumentTypeDefault value
duration500
locationsnull

Args:

  • locations - an array of tuples representing the x/y coordinates of the fingers to tap. Length can be up to five.
  • duration - length of time to tap, in ms. Default: 500ms

Usage

@{firstFinger}create list${100}${500}
@{secondFinger}create list |${700}${500}
@{fingerPositions}create list${firstFinger}${secondFinger}
Sleep1
Tap with Positions${1000}@{fingerPositions}

New in AppiumLibrary v2

Terminate the given app on the device

Arguments

ArgumentTypeDefault value
app_idnull

Args:

  • app_id - BundleId for iOS. Package name for Android.

New in AppiumLibrary v2

Verifies that element identified with text is visible.

Arguments

ArgumentTypeDefault value
textnull
exact_matchFalse
loglevelINFO

New in AppiumLibrary 1.4.5

Toggle Touch ID enrolled state on iOS Simulator

New in AppiumLibrary 1.5

Simulate Touch ID on iOS Simulator

Arguments

ArgumentTypeDefault value
matchTrue

match (boolean) whether the simulated fingerprint is valid (default true)

New in AppiumLibrary 1.5

Wait for an activity: block until target activity presents or time out.

Arguments

ArgumentTypeDefault value
activitynull
timeoutnull
interval1

Android only.

  • activity - target activity
  • timeout - max wait time, in seconds
  • interval - sleep interval between retries, in seconds

Waits until element specified with locator is visible.

Arguments

ArgumentTypeDefault value
locatornull
timeoutNone
errorNone

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.

Waits until text appears on current page.

Arguments

ArgumentTypeDefault value
textnull
timeoutNone
errorNone

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.

Waits until element specified with locator appears on current page.

Arguments

ArgumentTypeDefault value
locatornull
timeoutNone
errorNone

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.

Waits until text disappears from current page.

Arguments

ArgumentTypeDefault value
textnull
timeoutNone
errorNone

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.

Waits until element specified with locator disappears from current page.

Arguments

ArgumentTypeDefault value
locatornull
timeoutNone
errorNone

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.

Verifies that the page contains the given number of elements located by the given xpath.

Arguments

ArgumentTypeDefault value
xpathnull
countnull
errorNone
loglevelINFO

One should not use the xpath= prefix for 'xpath'. XPath is assumed.

Correct:
Xpath Should Match X Times//android.view.View[@text='Test']1
Incorrect:
Xpath Should Match X Timesxpath=//android.view.View[@text='Test']1

error can be used to override the default error message.

See Log Source for explanation about loglevel argument.

New in AppiumLibrary 1.4.

DEPRECATED!! Zooms in on an element a certain amount.

Arguments

ArgumentTypeDefault value
locatornull
percent200%
steps1