Appium
getLogTypes
Get available log types.
Appium command. More details can be found in the official protocol docs.
Usage
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
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
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
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
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
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
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
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
driver.getAppiumSessionCapabilities()
Returns
- <Object>
capabilities
: An object describing the session's capabilities.
shake
Perform a shake action on the device.
Appium command. More details can be found in the official protocol docs.
Usage
driver.shake()
Support
lock
Lock the device.
Appium command. More details can be found in the official protocol docs.
Usage
driver.lock(seconds)
Parameters
Name | Type | Details |
---|---|---|
seconds optional | number | how long to lock the screen (iOS only) |
Support
unlock
Unlock the device.
Appium command. More details can be found in the official protocol docs.
Usage
driver.unlock()
Support
isLocked
Check whether the device is locked or not.
Appium command. More details can be found in the official protocol docs.
Usage
driver.isLocked()
Returns
- <boolean>
isLocked
: True if the device is locked, false if not
Support
startRecordingScreen
Start recording the screen.
Appium command. More details can be found in the official protocol docs.
Usage
driver.startRecordingScreen(options)
Parameters
Name | Type | Details |
---|---|---|
options optional | 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
stopRecordingScreen
Stop recording screen
Appium command. More details can be found in the official protocol docs.
Usage
driver.stopRecordingScreen(remotePath, username, password, method)
Parameters
Name | Type | Details |
---|---|---|
remotePath optional | 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. |
username optional | string | The name of the user for the remote authentication. |
password optional | string | The password for the remote authentication. |
method optional | 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
getPerformanceDataTypes
Returns the information types of the system state which is supported to read as like cpu, memory, network traffic, and battery.
Appium command. More details can be found in the official protocol docs.
Usage
driver.getPerformanceDataTypes()
Returns
- <string[]>
performanceTypes
: The available performance data types (cpuinfo|batteryinfo|networkinfo|memoryinfo)
Support
getPerformanceData
Returns the information of the system state which is supported to read as like cpu, memory, network traffic, and battery.
Appium command. More details can be found in the official protocol docs.
Usage
driver.getPerformanceData(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 |
dataReadTimeout optional | 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
pressKeyCode
Press a particular key on the device.
Appium command. More details can be found in the official protocol docs.
Usage
driver.pressKeyCode(keycode, metastate, flags)
Parameters
Name | Type | Details |
---|---|---|
keycode | number | keycode to press |
metastate optional | number | meta state to press the keycode with |
flags optional | number | flags for the keypress |
Support
longPressKeyCode
Press and hold a particular key code on the device.
Appium command. More details can be found in the official protocol docs.
Usage
driver.longPressKeyCode(keycode, metastate, flags)
Parameters
Name | Type | Details |
---|---|---|
keycode | number | keycode to press on the device |
metastate optional | number | metastate for the keypress |
flags optional | number | flags for the keypress |
Support
sendKeyEvent
Send a key code to the device.
Appium command. More details can be found in the official protocol docs.
Usage
driver.sendKeyEvent(keycode, metastate)
Parameters
Name | Type | Details |
---|---|---|
keycode | string | keycode to press |
metastate optional | string | meta state to press the keycode with |
Support
rotateDevice
Rotate the device in three dimensions.
Appium command. More details can be found in the official protocol docs.
Usage
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
getCurrentActivity
Get the name of the current Android activity.
Appium command. More details can be found in the official protocol docs.
Usage
driver.getCurrentActivity()
Returns
- <string>
activity
: Name of the current activity
Support
getCurrentPackage
Get the name of the current Android package.
Appium command. More details can be found in the official protocol docs.
Usage
driver.getCurrentPackage()
Returns
- <string>
package
: Name of the current package
Support
installApp
Install the given app onto the device.
Appium command. More details can be found in the official protocol docs.
Usage
driver.installApp(appPath)
Parameters
Name | Type | Details |
---|---|---|
appPath | string | path to application .apk file |
Support
activateApp
Activate the given app onto the device
Appium command. More details can be found in the official protocol docs.
Usage
driver.activateApp(appId)
Parameters
Name | Type | Details |
---|---|---|
appId | string | App ID (package ID for Android, bundle ID for iOS) |
Support
removeApp
Remove an app from the device.
Appium command. More details can be found in the official protocol docs.
Usage
driver.removeApp(appId)
Parameters
Name | Type | Details |
---|---|---|
appId | string | App ID (package ID for Android, bundle ID for iOS) |
Support
terminateApp
Terminate the given app on the device
Appium command. More details can be found in the official protocol docs.
Usage
driver.terminateApp(appId, options)
Parameters
Name | Type | Details |
---|---|---|
appId | string | App ID (package ID for Android, bundle ID for iOS) |
options optional | object | Command options. E.g. "timeout": (Only Android) Timeout to retry terminate the app (see more in Appium docs) |
Support
isAppInstalled
Check whether the specified app is installed on the device.
Appium command. More details can be found in the official protocol docs.
Usage
driver.isAppInstalled(appId)
Parameters
Name | Type | Details |
---|---|---|
appId | string | App ID (package ID for Android, bundle ID for iOS) |
Returns
- <boolean>
isAppInstalled
: Return true if installed, false if not
Support
queryAppState
Get the given app status on the device
Appium command. More details can be found in the official protocol docs.
Usage
driver.queryAppState(appId)
Parameters
Name | Type | Details |
---|---|---|
appId | string | App ID (package ID for Android, bundle ID for iOS) |
Returns
- <number>
appStatus
: 0 is not installed. 1 is not running. 2 is running in background or suspended. 3 is running in background. 4 is running in foreground
Support
hideKeyboard
Hide soft keyboard.
Appium command. More details can be found in the official protocol docs.
Usage
driver.hideKeyboard(strategy, key, keyCode, keyName)