mob
Provides methods for mobile automation.
Last updated
Provides methods for mobile automation.
Last updated
Locators:
Native application locators for
/XPATH
- Locates element using an XPath 1.0 expression.
~ACCESSIBILITY_ID
- Locates element by its Accessibility Id.
id=ID
- Locates element by its id.
class=CLASS
- Locates element by its class.
text=TEXT
- Locates element by its visible text.
text-contains=TEXT
- Locates element whose visible text contains the specified string.
desc=DESCRIPTION
- Locates element by its description.
desc-contains=DESCRIPTION
- Locates element whose description contains the specified string.
scrollable
- Locates elements that are scrollable.
Native application locators for
/XPATH
- Locates element using an XPath 1.0 expression.
id=ID
- Locates element by its ID.
~ACCESSIBILITY_ID
- Locates element by its Accessibility Id.
-ios predicate string:PREDICATE_STRING
- Locates element using a predicate query.
-ios class chain:CLASS_CHAIN
- Locates element using a class chain expression.
/XPATH
- Locates element using an XPath 1.0 expression.
id=ID
- Locates element by its id.
name=NAME
- Locates element by its name attribute.
tag=NAME
- Locates element by its tag name.
link=TEXT
- Locates anchor element whose text matches the given string.
link-contains=TEXT
- Locates anchor element whose text contains the given string.
css=CSS_SELECTOR
- Locates element using a CSS selector.
Pattern arguments:
Commands which expect a string matching pattern in their arguments, support following patterns unless specified otherwise:
regex:PATTERN
- Match using regular expression.
PATTERN
- Verbatim matching.
Accepts an alert or a confirmation dialog.
In case of an alert box this command is identical to alertDismiss
.
** Usage example:**
Dismisses an alert or a confirmation dialog.
In case of an alert box this command is identical to alertAccept
.
** Usage example:**
Asserts whether alert matches the specified pattern and dismisses it.
Text pattern can be any of the supported string matching patterns(on the top of page).
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Text pattern. |
|
|
|
Asserts element's inner text.
Text pattern can be any of the supported string matching patterns (on the top of page). If the element is not interactable, then it will allways return empty string as its text.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
| Assertion text or pattern. |
|
|
|
Asserts the page title.
Assertion pattern can be any of the supported string matching patterns(on the top of page).
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Assertion text or pattern. |
|
|
|
Asserts element's value.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
| Value pattern. |
|
|
|
Navigate backwards in the browser history or simulates back button on Android device.
** Usage example:**
Clears element's value or content
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
Clicks on an element.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
Clicks on a non-visible element.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
Performs a long click/touch on an element.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
| Touch duration in milliseconds. |
|
|
|
Performs tap on an element multiple times in quick succession.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
| Number of taps. |
|
|
|
Closes the currently open app.
** Usage example:**
Stop test execution and allow interactive command execution (REPL).
** Usage example:**
Ends the current session.
Parameters:
Name | Type | Description |
---|---|---|
|
|
|
Tap on an element, drag by the specified offset, and release.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator on which to perform the initial tap. |
|
| Horizontal offset. Positive for right direction; Negative for left. |
|
| Vertical offset. Positive for down direction; Negative for up. |
|
|
|
Enable or disable wifi or data.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Enable (true) or disable (false) wifi. |
|
| Enable (true) or disable (false) data. |
Executes JavaScript in the context of the currently selected frame or window.
If return value is null or there is no return value, null
is returned.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| The JavaScript to execute. |
|
|
|
Returns:
Object
- The return value.
Finds an element.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
|
|
|
Returns:
Element
- A Element object.
Finds elements.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
|
|
|
Returns:
Array.<Element>
- Collection of Element objects.
Gets the text displayed by an alert or confirm dialog.
** Usage example:**
Returns:
String
- Alert's text.
Collects logs from the Appium server.
** Usage example:**
Returns:
Array.<Object>
- A list of logs.
Collects browser logs from the mobile device.
** Usage example:**
Returns:
Array.<Object>
- A list of logs.
Returns currently defined capabilities.
Returns:
Object
- Current capabilities object.
Gets current Android app's activity name.
** Usage example:**
Gets current Android app's package name.
** Usage example:**
Collects logs from the mobile device.
** Usage example:**
Returns:
Array.<Object>
- A list of logs.
Gets the time on the device.
** Usage example:**
Returns:
String
- Time.
Returns the underlying WDIO driver.
Returns:
Object
- WDIO driver.
Get element's location.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
Returns:
Object
- X and Y location of the element relative to top-left page corner.
Gets the source code of the page.
** Usage example:**
Returns:
String
- HTML in case of web or hybrid application or XML in case of native.
Returns the text (rendered text shown to the user; whitespace-trimmed) of an element.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
Returns:
String
- Element's text.
Returns the title of the currently active window.
Returns:
String
- The page title.
Gets the URL of the currently active window.
** Usage example:**
Returns:
String
- The page URL.
Gets element's value (whitespace-trimmed).
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
Returns:
String
- Element's value.
Gets handles of currently open windows.
** Usage example:**
Returns:
Array.<String>
- Array of all available window handles.
Hides device keyboard.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Initializes a new Appium session.
Parameters:
Name | Type | Description |
---|---|---|
|
|
|
|
|
|
Install an app on the remote device.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| The local file path to APK or IPA file. |
Determines if an app is installed on the device.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| App's ID. |
Determines if checkbox or radio element is checkable.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
Returns:
Boolean
- true if element is checkable. false otherwise.
Determines if checkbox or radio element is checked.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
Returns:
Boolean
- true if element is checked. false otherwise.
Determines if an element is clickable.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
Returns:
Boolean
- true if element is clickable. false otherwise.
Wait for an element to become available.
The element is not necessary needs to be visible.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
Returns:
Boolean
- true if the element exists. false otherwise.
Determines if an element is selected.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
Returns:
Boolean
- true if element is selected. false otherwise.
Checks if element is present and visible. Returns false if element was not found or wasn't visible within the specified timeout.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| An element locator. |
|
|
|
Returns:
Boolean
- True if element was found and it was visible. False otherwise.
Checks if the current context is of WebView type.
** Usage example:**
Returns:
Boolean
- true if the context name is WEBVIEW or CHROMIUM.
Launches the app defined in the current session's capabilities.
** Usage example:**
Press and hold a particular key code on the device.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Key code pressed on the device. |
Opens an URL.
The open
command waits for the page to load before proceeding.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| The URL to open; may be relative or absolute. |
Pause test execution for the given amount of milliseconds.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Milliseconds to pause the execution for. |
Remove an app from the device.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| App's ID. |
Reset the currently running app's state (e.g. local settings) on the device.
** Usage example:**
Scrolls the view element until a specified target element inside the view is found.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| View element to scroll. |
|
| Target element to find in the view. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Scrolls the page or a container element to the location of the specified element.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| An element locator. |
|
|
|
|
|
|
Selects an option from a drop-down list using an option locator. This command works with multiple-choice lists as well.
Option locator can be one of the following (No prefix is same as label matching):
- label=STRING
- Matches option based on the visible text.
- value=STRING
- Matches option based on its value.
- index=STRING
- Matches option based on its index. The index is 0-based.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| An element locator identifying a drop-down menu. |
|
| An option locator. |
|
|
|
Selects a frame or an iframe within the current window.
Available frame locators:
- 'parent'
- Select parent frame.
- 'top'
- Select top window.
- NUMBER
- Select frame by its 0-based index.
- LOCATOR
- Locator identifying the frame (relative to the top window). Multiple locators can be passed in order to switch between nested frames.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
|
|
Selects window. Once window has been selected, all commands go to that window.
windowLocator
can be:
title=TITLE
Switch to the first window which matches the specified title. TITLE
can be any ofthe supported string matching patterns (see top of the page). When using title locator, this commandwill wait for the window to appear first similarly to waitForWindow
command.
url=URL
Switch to the first window which matches the specified URL. URL
can be any ofthe supported string matching patterns (see top of the page). When using url locator, this commandwill wait for the window to appear first similarly to waitForWindow
command.
windowHandle
Switch to a window using its unique handle.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
|
|
|
|
|
Returns:
String
- windowHandle of the previously selected window.
Send a sequence of keyboard strokes to the active window or element.
Refer to Key Codes for the list of supported raw keyboard key codes.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Sequence of key strokes to send. Can be either a string or an array of strings for sending raw key codes. |
Sets a specific context (NATIVE_APP, WEBVIEW, etc.).
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| The context name. |
Sets context to NATIVE_APP.
** Usage example:**
Specifies the amount of time that Oxygen will wait for actions to complete.
This includes the open
command, waitFor*
commands, and commands which wait for elements to appear in DOM or become visible before operating on them.
If command wasn't able to complete within the specified period it will fail the test.
The default time-out is 60 seconds.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| A time-out in milliseconds. |
Sets context to the first available WEBVIEW or CHROMIUM (Crosswalk WebView) view.
** Usage example:**
Returns:
String
- Context name, or null if no web context found.
Perform shake action on the device
Supported on Android and iOS 9 or earlier versions.
** Usage example:**
Clicks SMS message URL.
SMSPopup
application must be installed and running on the device to use this command. https://github.com/oxygenhq/android-smspopup/releases
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
|
|
Gets SMS text on Android phone.
SMSPopup
application must be installed and running on the device to use this command. https://github.com/oxygenhq/android-smspopup/releases
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
|
|
Returns:
String
- SMS text.
Perform a swipe on an element.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Locator of the element to swipe on. |
|
|
|
|
|
|
|
|
|
|
|
|
Perform swipe on the element.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Locator of the element to swipe on. |
|
|
|
|
|
|
|
|
|
|
|
|
Perform a swipe on the screen.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Starting X position (top-left screen corner is the origin) |
|
| Starting Y position. |
|
| Ending X position. |
|
| Ending Y position. |
|
|
|
Take a screenshot of the current page or screen and return it as base64 encoded string.
** Usage example:**
Returns:
String
- Screenshot image encoded as a base64 string.
Perform tap at the specified coordinate.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| x offset. |
|
| y offset. |
Opens new transaction.
The transaction will persist till a new one is opened. Transaction names must be unique.
Parameters:
Name | Type | Description |
---|---|---|
|
| The transaction name. |
Send a sequence of key strokes to an element (clears value before).
Refer to Key Codes for the list of supported raw keyboard key codes.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| An element locator. |
|
| The value to type. |
|
|
|
Unlocks a pattern lock
:
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator for the pattern lock. |
|
| Number of columns in the pattern. |
|
| Number of rows in the pattern. |
|
| Pattern sequence. Pins are hexadecimal and case sensitive. See example. |
|
|
|
Wait for an element for the provided amount of milliseconds to exist in DOM.
The element is not necessary needs to be visible.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
Waits for element to become interactable.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| An element locator. |
|
|
|
Waits for element to become visible.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
Hybrid and Web application locators for
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On:
Supported On: