win
Provides methods for Windows native applications automation.
Locators:
/XPATH
- Locates element using an XPath 1.0 expression.~AccessibilityId
- Locates element by its Accessibility ID. Attribute name in inspect.exe - AutomationId.name=NAME
- Locates element by its name. Attribute name in inspect.exe - Name.id=ID
- Locates element by its ID. Attribute name in inspect.exe - RuntimeID.
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.
assertText
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.
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
| Assertion text or pattern. |
|
|
|
assertTitle
Asserts the page title.
Assertion pattern can be any of the supported string matching patterns(on the top of page).
Parameters:
Name | Type | Description |
---|---|---|
|
| Assertion text or pattern. |
|
|
|
assertValue
Asserts element's value.
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
| Value pattern. |
|
|
|
back
Navigate backwards in the browser history or simulates back button on Android device.
clear
Clears element's value or content
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
click
Clicks on an element.
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
clickLong
Performs a long click/touch on an element.
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
| Touch duration in milliseconds. |
|
|
|
clickMultipleTimes
Performs tap on an element multiple times in quick succession.
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
| Number of taps. |
|
|
|
dispose
Ends the current session.
findElement
Finds an element.
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
|
|
|
Returns:
Element
- A Element object.
findElements
Finds elements.
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
|
|
|
Returns:
Array.<Element>
- Collection of Element objects.
getAppiumLogs
Collects logs from the Appium server.
Returns:
Array.<Object>
- A list of logs.
getCapabilities
Returns currently defined capabilities.
Returns:
Object
- Current capabilities object.
getCurrentWindowHandle
Gets current window handle.
** Usage example:**
Returns:
String
- A window handle.
getDriver
Returns the underlying WDIO driver.
Returns:
Object
- WDIO driver.
getLocation
Get element's location.
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
Returns:
Object
- X and Y location of the element relative to top-left page corner.
getSource
Gets the source code of the page.
Returns:
String
- HTML in case of web or hybrid application or XML in case of native.
getText
Returns the text (rendered text shown to the user; whitespace-trimmed) of an element.
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
Returns:
String
- Element's text.
getValue
Gets element's value (whitespace-trimmed).
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
Returns:
String
- Element's value.
getWindowHandles
Gets handles of currently open windows.
** Usage example:**
Returns:
Array.<String>
- Array of all available window handles.
init
Initializes a new Appium session.
Parameters:
Name | Type | Description |
---|---|---|
|
|
|
|
|
|
isCheckable
Determines if checkbox or radio element is checkable.
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
Returns:
Boolean
- true if element is checkable. false otherwise.
isChecked
Determines if checkbox or radio element is checked.
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
Returns:
Boolean
- true if element is checked. false otherwise.
isClickable
Determines if an element is clickable.
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
Returns:
Boolean
- true if element is clickable. false otherwise.
isExist
Wait for an element to become available.
The element is not necessary needs to be visible.
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
Returns:
Boolean
- true if the element exists. false otherwise.
isSelected
Determines if an element is selected.
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
Returns:
Boolean
- true if element is selected. false otherwise.
isVisible
Checks if element is present and visible. Returns false if element was not found or wasn't visible within the specified timeout.
Parameters:
Name | Type | Description |
---|---|---|
|
| An element locator. |
|
|
|
Returns:
Boolean
- True if element was found and it was visible. False otherwise.
open
Opens an URL.
The open
command waits for the page to load before proceeding.
Parameters:
Name | Type | Description |
---|---|---|
|
| The URL to open; may be relative or absolute. |
pause
Pause test execution for the given amount of milliseconds.
Parameters:
Name | Type | Description |
---|---|---|
|
| Milliseconds to pause the execution for. |
rightClick
Perform right click on an element.
Parameters:
Name | Type | Description |
---|---|---|
|
| An element locator. |
|
|
|
selectWindow
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 towaitForWindow
command.windowHandle
Switch to a window using its unique handle.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
|
|
|
|
|
Returns:
String
- windowHandle of the previously selected window.
sendKeys
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. |
setTimeout
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.
Parameters:
Name | Type | Description |
---|---|---|
|
| A time-out in milliseconds. |
takeScreenshot
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.
tap
Perform tap at the specified coordinate.
Parameters:
Name | Type | Description |
---|---|---|
|
| x offset. |
|
| y offset. |
transaction
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. |
type
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.
Parameters:
Name | Type | Description |
---|---|---|
|
| An element locator. |
|
| The value to type. |
|
|
|
waitForExist
Wait for an element for the provided amount of milliseconds to exist in DOM.
The element is not necessary needs to be visible.
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
waitForInteractable
Waits for element to become interactable.
** Usage example:**
Parameters:
Name | Type | Description |
---|---|---|
|
| An element locator. |
|
|
|
waitForVisible
Waits for element to become visible.
Parameters:
Name | Type | Description |
---|---|---|
|
| Element locator. |
|
|
|
Last updated