Appium
getLogTypes
Get available log types.
Appium command. More details can be found in the official protocol docs.
Usage
await driver.getLogTypes()
Returns
- <String[]>
logTypes: The list of available log types, example: browser, driver.
getLogs
Get the log for a given log type. Log buffer is reset after each request.
Appium command. More details can be found in the official protocol docs.
Usage
await driver.getLogs(type)
Parameters
| Name | Type | Details |
|---|---|---|
type | string | the log type |
Returns
- <Object[]>
logs: The list of log entries.
getSession
Retrieve the capabilities of the current session.
Appium command. More details can be found in the official protocol docs.
This protocol command is deprecated
Use getAppiumSessionCapabilities instead
Usage
await driver.getSession()
Returns
- <Object>
capabilities: An object describing the session's capabilities.
getAppiumContext
Appium command. More details can be found in the official protocol docs.
Usage
await driver.getAppiumContext()
Returns
- <Context>
context: a string representing the current context or null representing 'no context'
switchAppiumContext
Appium command. More details can be found in the official protocol docs.
Usage
await driver.switchAppiumContext(name)
Parameters
| Name | Type | Details |
|---|---|---|
name | string | a string representing an available context |
getAppiumContexts
Appium command. More details can be found in the official protocol docs.
Usage
await driver.getAppiumContexts()
Returns
- <Context[]>
contexts: an array of strings representing available contexts, e.g. 'WEBVIEW', or 'NATIVE'
getAppiumCommands
Retrieve the endpoints and BiDi commands supported in the current session.
Appium command. More details can be found in the official protocol docs.
Usage
await driver.getAppiumCommands()
Returns
- <Object>
commands: Supported endpoints and BiDi commands, each grouped into common, driver-specific, and plugin-specific endpoints/commands.
getAppiumExtensions
Retrieve the extension commands supported in the current session.
Appium command. More details can be found in the official protocol docs.
Usage
await driver.getAppiumExtensions()
Returns
- <Object>
commands: Supported extension commands, grouped into driver-specific and plugin-specific commands.
getAppiumSessionCapabilities
Retrieve the capabilities of the current session.
Appium command. More details can be found in the official protocol docs.
Usage
await driver.getAppiumSessionCapabilities()
Returns
- <Object>
capabilities: An object describing the session's capabilities.
appiumShake
Perform a shake action on the device. This is the raw Appium protocol endpoint. Prefer the shake mobile command which provides automatic Appium 3 compatibility with fallback for older drivers.
Appium command. More details can be found in the official protocol docs.
This protocol command is deprecated
Use the shake mobile command (driver.shake()) instead
Usage
await driver.appiumShake()
Support
- iOS: XCUITest (9.3+), UIAutomation (8.0 to 9.3)
appiumLock
Lock the device. This is the raw Appium protocol endpoint. Prefer the lock mobile command which provides automatic Appium 3 compatibility with fallback for older drivers.
Appium command. More details can be found in the official protocol docs.
This protocol command is deprecated
Use the lock mobile command (driver.lock()) instead
Usage
await driver.appiumLock(seconds)
Parameters
| Name | Type | Details |
|---|---|---|
secondsoptional | number | how long to lock the screen (iOS only) |
Support
- iOS: UIAutomation (8.0 to 9.3)
- Android: UiAutomator (4.2+)
- Windows: Windows (10+)
appiumUnlock
Unlock the device. This is the raw Appium protocol endpoint. Prefer the unlock mobile command which provides automatic Appium 3 compatibility with fallback for older drivers.
Appium command. More details can be found in the official protocol docs.
This protocol command is deprecated
Use the unlock mobile command (driver.unlock()) instead
Usage
await driver.appiumUnlock()
Support
- Android: UiAutomator (4.2+)
- Windows: Windows (10+)
appiumIsLocked
Check whether the device is locked or not. This is the raw Appium protocol endpoint. Prefer the isLocked mobile command which provides automatic Appium 3 compatibility with fallback for older drivers.
Appium command. More details can be found in the official protocol docs.
This protocol command is deprecated
Use the isLocked mobile command (driver.isLocked()) instead
Usage
await driver.appiumIsLocked()
Returns
- <boolean>
isLocked: True if the device is locked, false if not
Support
- Android: UiAutomator (4.2+)
- Windows: Windows (10+)
startRecordingScreen
Start recording the screen.
Appium command. More details can be found in the official protocol docs.
Usage
await driver.startRecordingScreen(options)
Parameters
| Name | Type | Details |
|---|---|---|
optionsoptional | object | command parameters that can contain keys like: remotePath, username, password, method, forceRestart, timeLimit, videoType, videoQuality, videoFps, bitRate, videoSize, bugReport (see more description in Appium docs) |
Support
- iOS: XCUITest (9.3+)
- Android: UiAutomator (4.2+)
- Windows: Windows (10+)
stopRecordingScreen
Stop recording screen.
Appium command. More details can be found in the official protocol docs.
Usage
await driver.stopRecordingScreen(remotePath, username, password, method)
Parameters
| Name | Type | Details |
|---|---|---|
remotePathoptional | string | The path to the remote location, where the resulting video should be uploaded. The following protocols are supported http/https, ftp. This option only has an effect if there is screen recording process in progreess and forceRestart parameter is not set to true. Null or empty string value (the default setting) means the content of resulting file should be encoded as Base64. |
usernameoptional | string | The name of the user for the remote authentication. |
passwordoptional | string | The password for the remote authentication. |
methodoptional | string | The http multipart upload method name. The 'PUT' one is used by default. |
Returns
- <string>
response: Base64 encoded string. If remote_path is set, the response is empty string
Support
- iOS: XCUITest (9.3+)
- Android: UiAutomator (4.2+)
- Windows: Windows (10+)
appiumGetPerformanceDataTypes
Returns the information types of the system state which is supported to read as like cpu, memory, network traffic, and battery. This is the raw Appium protocol endpoint. Prefer the getPerformanceDataTypes mobile command which provides automatic Appium 3 compatibility with fallback for older drivers.
Appium command. More details can be found in the official protocol docs.
This protocol command is deprecated
Use the getPerformanceDataTypes mobile command (driver.getPerformanceDataTypes()) instead
Usage
await driver.appiumGetPerformanceDataTypes()
Returns
- <string[]>
performanceTypes: The available performance data types (cpuinfo|batteryinfo|networkinfo|memoryinfo)
Support
- Android: UiAutomator (4.2+)
appiumGetPerformanceData
Returns the information of the system state which is supported to read as like cpu, memory, network traffic, and battery. This is the raw Appium protocol endpoint. Prefer the getPerformanceData mobile command which provides automatic Appium 3 compatibility with fallback for older drivers.
Appium command. More details can be found in the official protocol docs.
This protocol command is deprecated
Use the getPerformanceData mobile command (driver.getPerformanceData()) instead
Usage
await driver.appiumGetPerformanceData(packageName, dataType, dataReadTimeout)
Parameters
| Name | Type | Details |
|---|---|---|
packageName | string | the package name of the application |
dataType | string | the type of system state which wants to read. It should be one of the supported performance data types |
dataReadTimeoutoptional | number | the number of attempts to read |
Returns
- <string[]>
performanceData: The information type of the system state which is supported to read as like cpu, memory, network traffic, and battery
Support
- Android: UiAutomator (4.2+)
appiumPressKeyCode
Press a particular key on the device. This is the raw Appium protocol endpoint. Prefer the pressKeyCode mobile command which provides automatic Appium 3 compatibility with fallback for older drivers.
Appium command. More details can be found in the official protocol docs.
This protocol command is deprecated
Use the pressKeyCode mobile command (driver.pressKeyCode()) instead
Usage
await driver.appiumPressKeyCode(keycode, metastate, flags)
Parameters
| Name | Type | Details |
|---|---|---|
keycode | number | keycode to press |
metastateoptional | number | meta state to press the keycode with |
flagsoptional | number | flags for the keypress |
Support
- Android: UiAutomator (4.2+)
appiumLongPressKeyCode
Press and hold a particular key code on the device. This is the raw Appium protocol endpoint. Prefer the longPressKeyCode mobile command which provides automatic Appium 3 compatibility with fallback for older drivers.
Appium command. More details can be found in the official protocol docs.
This protocol command is deprecated
Use the longPressKeyCode mobile command (driver.longPressKeyCode()) instead
Usage
await driver.appiumLongPressKeyCode(keycode, metastate, flags)
Parameters
| Name | Type | Details |
|---|---|---|
keycode | number | keycode to press on the device |
metastateoptional | number | metastate for the keypress |
flagsoptional | number | flags for the keypress |
Support
- Android: UiAutomator (4.2+)
appiumSendKeyEvent
Send a key code to the device. This is the raw Appium protocol endpoint. Prefer the pressKeyCode mobile command which provides automatic Appium 3 compatibility with fallback for older drivers.
Appium command. More details can be found in the official protocol docs.
This protocol command is deprecated
Use the pressKeyCode mobile command (driver.pressKeyCode()) instead
Usage
await driver.appiumSendKeyEvent(keycode, metastate)
Parameters
| Name | Type | Details |
|---|---|---|
keycode | string | keycode to press |
metastateoptional | string | meta state to press the keycode with |
Support
- Android: UiAutomator (4.2+)
rotateDevice
Rotate the device in three dimensions.
Appium command. More details can be found in the official protocol docs.
Usage
await driver.rotateDevice(x, y, z)
Parameters
| Name | Type | Details |
|---|---|---|
x | number | x offset to use for the center of the rotate gesture |
y | number | y offset to use for the center of the rotate gesture |
z | number | z offset to use for the center of the rotate gesture |
Support
- iOS: UIAutomation (8.0 to 9.3)
- Android: UiAutomator (4.2+)
appiumGetCurrentActivity
Get the name of the current Android activity. This is the raw Appium protocol endpoint. Prefer the getCurrentActivity mobile command which provides automatic Appium 3 compatibility with fallback for older drivers.
Appium command. More details can be found in the official protocol docs.
This protocol command is deprecated
Use the getCurrentActivity mobile command (driver.getCurrentActivity()) instead
Usage
await driver.appiumGetCurrentActivity()
Returns
- <string>
activity: Name of the current activity
Support
- Android: UiAutomator (4.2+)
appiumGetCurrentPackage
Get the name of the current Android package. This is the raw Appium protocol endpoint. Prefer the getCurrentPackage mobile command which provides automatic Appium 3 compatibility with fallback for older drivers.
Appium command. More details can be found in the official protocol docs.
This protocol command is deprecated
Use the getCurrentPackage mobile command (driver.getCurrentPackage()) instead
Usage
await driver.appiumGetCurrentPackage()
Returns
- <string>
package: Name of the current package
Support
- Android: UiAutomator (4.2+)
installApp
Install the given app onto the device.
Appium command. More details can be found in the official protocol docs.
Usage
await driver.installApp(appPath, options)
Parameters
| Name | Type | Details |
|---|---|---|
appPath | string | Path to application .apk file |
optionsoptional | object | Driver-specific installation options |
Support
- iOS: XCUITest (9.3+), UIAutomation (8.0 to 9.3)
- Android: UiAutomator (4.2+)
activateApp
Activate the given app on the device
Appium command. More details can be found in the official protocol docs.
Usage
await driver.activateApp(appId, bundleId, options)
Parameters
| Name | Type | Details |
|---|---|---|
appIdoptional | string | App package ID (required for Android) |
bundleIdoptional | string | Bundle ID (required for iOS) |
optionsoptional | object | Driver-specific launch options |
Support
- iOS: XCUITest (9.3+)
- Android: UiAutomator (4.2+)
removeApp
Remove an app from the device.
Appium command. More details can be found in the official protocol docs.
Usage
await driver.removeApp(appId, bundleId, options)
Parameters
| Name | Type | Details |
|---|---|---|
appIdoptional | string | App package ID (required for Android) |
bundleIdoptional | string | Bundle ID (required for iOS) |
optionsoptional | object | Driver-specific uninstall options |
Returns
- <boolean>
didRemovalSucceed: Return true if uninstall was successful, false if not
Support
- iOS: XCUITest (9.3+), UIAutomation (8.0 to 9.3)
- Android: UiAutomator (4.2+)
terminateApp
Terminate the given app on the device
Appium command. More details can be found in the official protocol docs.
Usage
await driver.terminateApp(appId, bundleId, options)
Parameters
| Name | Type | Details |
|---|---|---|
appIdoptional | string | App package ID (required for Android) |
bundleIdoptional | string | Bundle ID (required for iOS) |
optionsoptional | object | Driver-specific termination options |
Support
- iOS: XCUITest (9.3+)
- Android: UiAutomator (4.2+)
isAppInstalled
Check whether the specified app is installed on the device.
Appium command. More details can be found in the official protocol docs.
Usage
await driver.isAppInstalled(appId, bundleId)
Parameters
| Name | Type | Details |
|---|---|---|
appIdoptional | string | App package ID (required for Android) |
bundleIdoptional | string | Bundle ID (required for iOS) |
Returns
- <boolean>
isAppInstalled: Return true if installed, false if not
Support
- iOS: XCUITest (9.3+), UIAutomation (8.0 to 9.3)
- Android: UiAutomator (4.2+)
queryAppState
Get the given app status on the device
Appium command. More details can be found in the official protocol docs.
Usage
await driver.queryAppState(appId, bundleId)
Parameters
| Name | Type | Details |
|---|---|---|
appIdoptional | string | App package ID (required for Android) |
bundleIdoptional | string | Bundle ID (required for iOS) |
Returns
- <number>
appStatus: 0 is not installed. 1 is not running. 2 is running in background suspended. 3 is running in background. 4 is running in foreground
Support
- iOS: XCUITest (9.3+)
- Android: UiAutomator (4.2+)
hideKeyboard
Hide soft keyboard.
Appium command. More details can be found in the official protocol docs.
Usage
await driver.hideKeyboard(strategy, key, keyCode, keyName)
Parameters
| Name | Type | Details |
|---|---|---|
strategyoptional | string | hide keyboard strategy (UIAutomation only), available strategies - 'press', 'pressKey', 'swipeDown', 'tapOut', 'tapOutside', 'default' |
keyoptional | string | key value if strategy is 'pressKey' |
keyCodeoptional | string | key code if strategy is 'pressKey' |
keyNameoptional | string | key name if strategy is 'pressKey' |
Support
- iOS: XCUITest (9.3+), UIAutomation (8.0 to 9.3)
- Android: UiAutomator (4.2+)
- Windows: Windows (10+)
isKeyboardShown
Whether or not the soft keyboard is shown.
Appium command. More details can be found in the official protocol docs.
Usage
await driver.isKeyboardShown()
Returns
- <boolean>
isKeyboardShown: True if the keyboard is shown
Support
- iOS: XCUITest (9.3+), UIAutomation (8.0 to 9.3)
- Android: UiAutomator (4.2+)
- Windows: Windows (10+)
pushFile
Place a file onto the device in a particular place.
Appium command. More details can be found in the official protocol docs.
Usage
await driver.pushFile(path, data)
Parameters
| Name | Type | Details |
|---|---|---|
path | string | path to install the data to |
data | string | contents of file in base64 |
Support
- iOS: XCUITest (9.3+), UIAutomation (8.0 to 9.3)
- Android: UiAutomator (4.2+)
- Windows: Windows (10+)
pullFile
Retrieve a file from the device's file system.
Appium command. More details can be found in the official protocol docs.
Usage
await driver.pullFile(path)
Parameters
| Name | Type | Details |
|---|---|---|
path | string | path on the device to pull file from |
Returns
- <string>
response: Contents of file in base64
Support
- iOS: XCUITest (9.3+), UIAutomation (8.0 to 9.3)
- Android: UiAutomator (4.2+)
- Windows: Windows (10+)
pullFolder
Retrieve a folder from the device's file system.
Appium command. More details can be found in the official protocol docs.
Usage
await driver.pullFolder(path)
Parameters
| Name | Type | Details |
|---|---|---|
path | string | path to an entire folder on the device |
Returns
- <string>
response: Zip file of the folder contents in base64
Support
- iOS: XCUITest (9.3+), UIAutomation (8.0 to 9.3)
- Android: UiAutomator (4.2+)
- Windows: Windows (10+)
appiumToggleAirplaneMode
Toggle airplane mode on device. This is the raw Appium protocol endpoint. Prefer the toggleAirplaneMode mobile command which provides automatic Appium 3 compatibility with fallback for older drivers.
Appium command. More details can be found in the official protocol docs.
This protocol command is deprecated
Use the toggleAirplaneMode mobile command (driver.toggleAirplaneMode()) instead
Usage
await driver.appiumToggleAirplaneMode()
Support
- Android: UiAutomator (4.2+)
appiumToggleData
Switch the state of data service. This is the raw Appium protocol endpoint. Prefer the toggleData mobile command which provides automatic Appium 3 compatibility with fallback for older drivers.
Appium command. More details can be found in the official protocol docs.
This protocol command is deprecated
Use the toggleData mobile command (driver.toggleData()) instead
Usage
await driver.appiumToggleData()
Support
- Android: UiAutomator (4.2+)
appiumToggleWiFi
Switch the state of the wifi service. This is the raw Appium protocol endpoint. Prefer the toggleWiFi mobile command which provides automatic Appium 3 compatibility with fallback for older drivers.
Appium command. More details can be found in the official protocol docs.
This protocol command is deprecated
Use the toggleWiFi mobile command (driver.toggleWiFi()) instead
Usage
await driver.appiumToggleWiFi()
Support
- Android: UiAutomator (4.2+)