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.
Supportโ
Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
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.
Supportโ
Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
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.
Supportโ
Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
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'
Supportโ
Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
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 |
Supportโ
Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
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'
Supportโ
Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
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.
Supportโ
Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
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.
Supportโ
Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
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.
Supportโ
Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
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 | Appium driver-specific recording options (refer to driver docs) |
Returnsโ
- <string>
response: Empty string, or the base64 encoded string of a previous screen recording, if forceRestart and remotePath are not set
Supportโ
- iOS: XCUITest (9.3+)
- Android: UiAutomator (4.2+)
- Windows: Windows (10+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
stopRecordingScreenโ
Stop recording the screen.
Appium command. More details can be found in the official protocol docs.
Usageโ
await driver.stopRecordingScreen(options)
Parametersโ
| Name | Type | Details |
|---|---|---|
optionsoptional | object | Appium driver-specific recording options (refer to driver docs) |
Returnsโ
- <string>
response: Base64 encoded string of the screen recording, or an empty string if the remotePath option is set
Supportโ
- iOS: XCUITest (9.3+)
- Android: UiAutomator (4.2+)
- Windows: Windows (10+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
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+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
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+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
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+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
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+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
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+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
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+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
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+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
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+) Mobilecli engine (beta): supported. Takes no strategy.
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+) Mobilecli engine (beta): supported.
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+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
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+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
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+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
getDeviceTimeโ
Get the time on the device.
Appium command. More details can be found in the official protocol docs.
Usageโ
await driver.getDeviceTime()
Returnsโ
- <string>
time: Time on the device
Supportโ
- iOS: XCUITest (9.3+), UIAutomation (8.0 to 9.3)
- Android: UiAutomator (4.2+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
getSettingsโ
Retrieve the current session settings.
Appium command. More details can be found in the official protocol docs.
Usageโ
await driver.getSettings()
Returnsโ
- <object>
settings: JSON hash of all the currently specified settings, see Settings API
Supportโ
- iOS: XCUITest (9.3+), UIAutomation (8.0 to 9.3)
- Android: UiAutomator (4.2+)
- Windows: Windows (10+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
updateSettingsโ
Update the session settings.
Appium command. More details can be found in the official protocol docs.
Usageโ
await driver.updateSettings(settings)
Parametersโ
| Name | Type | Details |
|---|---|---|
settings | object | key/value object with settings to update |
Supportโ
- iOS: XCUITest (9.3+), UIAutomation (8.0 to 9.3)
- Android: UiAutomator (4.2+)
- Windows: Windows (10+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
executeDriverScriptโ
Execute a script in a child process. This approach helps minimize potential latency associated with each command. Using this command in Appium 2 or later requires installing the execute-driver plugin.
Appium command. More details can be found in the official protocol docs.
Usageโ
await driver.executeDriverScript(script, type, timeout)
Parametersโ
| Name | Type | Details |
|---|---|---|
script | string | The script to execute. It has access to a 'driver' object which represents a WebdriverIO session attached to the current server. |
typeoptional | string | The language/framework used in the script. Currently, only 'webdriverio' is supported and is the default. |
timeoutoptional | number | The number of milliseconds the script should be allowed to run before being killed by the Appium server. Defaults to the equivalent of 1 hour. |
Returnsโ
- <object>
result: An object containing two fields: 'result', which is the return value of the script itself, and 'logs', which contains 3 inner fields, 'log', 'warn', and 'error', which hold an array of strings logged by console.log, console.warn, and console.error in the script's execution.
Supportโ
Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
getEventsโ
Get events logged in the current session.
Appium command. More details can be found in the official protocol docs.
Usageโ
await driver.getEvents(type)
Parametersโ
| Name | Type | Details |
|---|---|---|
typeoptional | string, string[] | One or more event types to filter the returned events |
Returnsโ
- <object>
result: A JSON hash of events like{'commands' => [{'cmd' => 123455, ....}], 'startTime' => 1572954894127, }.
Supportโ
- Android: UiAutomator (4.2+)
- iOS: XCUITest (9.3+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
logEventโ
Log a custom event.
Appium command. More details can be found in the official protocol docs.
Usageโ
await driver.logEvent(vendor, event)
Parametersโ
| Name | Type | Details |
|---|---|---|
vendor | string | Name of the namespace (vendor) used to prefix the event |
event | string | Name of the event |
Supportโ
- Android: UiAutomator (4.2+)
- iOS: XCUITest (9.3+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
compareImagesโ
Compare two images using the specified mode of comparison. Using this command in Appium 2 or later requires installing the images plugin.
Appium command. More details can be found in the official protocol docs.
Usageโ
await driver.compareImages(mode, firstImage, secondImage, options)
Parametersโ
| Name | Type | Details |
|---|---|---|
mode | string | One of possible comparison modes: 'matchFeatures', 'getSimilarity', 'matchTemplate'. |
firstImage | string | Base64-encoded image file. |
secondImage | string | Base64-encoded image file. |
options=[object Object]optional | object | The supported values of this property depend on the mode value. See Appium documentation for more details. |
Returnsโ
- <object>
result: The content of the resulting dictionary depends on themodeandoptionsvalues. See Appium documentation for more details.
Supportโ
Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
availableIMEEnginesโ
List all available IME engines on the device. To use an engine, it has to be present in this list.
Appium command. More details can be found in the official protocol docs.
Usageโ
await driver.availableIMEEngines()
Returnsโ
- <String[]>
engines: A list of available engines
Supportโ
- Android: UiAutomator (4.2+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
getActiveIMEEngineโ
Get the name of the active IME engine. The name string is platform specific.
Appium command. More details can be found in the official protocol docs.
Usageโ
await driver.getActiveIMEEngine()
Returnsโ
- <String>
engine: The name of the active IME engine
Supportโ
- Android: UiAutomator (4.2+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
isIMEActivatedโ
Indicates whether IME input is active at the moment
Appium command. More details can be found in the official protocol docs.
Usageโ
await driver.isIMEActivated()
Returnsโ
- <Boolean>
isActive: true if IME input is available and currently active, false otherwise
Supportโ
- Android: UiAutomator (4.2+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
deactivateIMEEngineโ
De-activates the currently-active IME engine.
Appium command. More details can be found in the official protocol docs.
Usageโ
await driver.deactivateIMEEngine()
Supportโ
- Android: UiAutomator (4.2+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
activateIMEEngineโ
Activates an IME engine.
Appium command. More details can be found in the official protocol docs.
Usageโ
await driver.activateIMEEngine(engine)
Parametersโ
| Name | Type | Details |
|---|---|---|
engine | string | name of the engine to activate |
Supportโ
- Android: UiAutomator (4.2+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
getOrientationโ
Get the current device orientation.
Appium command. More details can be found in the official protocol docs.
Usageโ
await driver.getOrientation()
Returnsโ
- <String>
orientation: The current orientation corresponding to a value defined in ScreenOrientation:LANDSCAPE|PORTRAIT.
Supportโ
- Android: UiAutomator (4.2+)
- iOS: XCUITest (9.3+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
setOrientationโ
Set the device orientation
Appium command. More details can be found in the official protocol docs.
Usageโ
await driver.setOrientation(orientation)
Parametersโ
| Name | Type | Details |
|---|---|---|
orientation | string | the new browser orientation as defined in ScreenOrientation: LANDSCAPE|PORTRAIT |
Supportโ
- Android: UiAutomator (4.2+)
- iOS: XCUITest (9.3+) Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
getGeoLocationโ
Get the current geo location.
Appium command. More details can be found in the official protocol docs.
Usageโ
await driver.getGeoLocation()
Returnsโ
- <Object>
location: The current geo location.
Supportโ
Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.
setGeoLocationโ
Set the current geo location.
Appium command. More details can be found in the official protocol docs.
Usageโ
await driver.setGeoLocation(location)
Parametersโ
| Name | Type | Details |
|---|---|---|
location | object | the new location ({latitude: number, longitude: number, altitude: number}) |
Supportโ
Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.