Skip to main content

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โ€‹

NameTypeDetails
typestringthe 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.

caution

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โ€‹

NameTypeDetails
namestringa 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โ€‹

NameTypeDetails
options
optional
objectAppium 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โ€‹

Support for XCUITest (9.3+) Support for UiAutomator (4.2+) Support for Windows (10+)

  • 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โ€‹

NameTypeDetails
options
optional
objectAppium 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โ€‹

Support for XCUITest (9.3+) Support for UiAutomator (4.2+) Support for Windows (10+)

  • 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โ€‹

NameTypeDetails
xnumberx offset to use for the center of the rotate gesture
ynumbery offset to use for the center of the rotate gesture
znumberz offset to use for the center of the rotate gesture

Supportโ€‹

Support for UIAutomation (8.0 to 9.3) Support for UiAutomator (4.2+)

  • 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โ€‹

NameTypeDetails
appPathstringPath to application .apk file
options
optional
objectDriver-specific installation options

Supportโ€‹

Support for XCUITest (9.3+), UIAutomation (8.0 to 9.3) Support for UiAutomator (4.2+)

  • 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โ€‹

NameTypeDetails
appId
optional
stringApp package ID (required for Android)
bundleId
optional
stringBundle ID (required for iOS)
options
optional
objectDriver-specific launch options

Supportโ€‹

Support for XCUITest (9.3+) Support for UiAutomator (4.2+)

  • 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โ€‹

NameTypeDetails
appId
optional
stringApp package ID (required for Android)
bundleId
optional
stringBundle ID (required for iOS)
options
optional
objectDriver-specific uninstall options

Returnsโ€‹

  • <boolean> didRemovalSucceed: Return true if uninstall was successful, false if not

Supportโ€‹

Support for XCUITest (9.3+), UIAutomation (8.0 to 9.3) Support for UiAutomator (4.2+)

  • 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โ€‹

NameTypeDetails
appId
optional
stringApp package ID (required for Android)
bundleId
optional
stringBundle ID (required for iOS)
options
optional
objectDriver-specific termination options

Supportโ€‹

Support for XCUITest (9.3+) Support for UiAutomator (4.2+)

  • 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โ€‹

NameTypeDetails
appId
optional
stringApp package ID (required for Android)
bundleId
optional
stringBundle ID (required for iOS)

Returnsโ€‹

  • <boolean> isAppInstalled: Return true if installed, false if not

Supportโ€‹

Support for XCUITest (9.3+), UIAutomation (8.0 to 9.3) Support for UiAutomator (4.2+)

  • 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โ€‹

NameTypeDetails
appId
optional
stringApp package ID (required for Android)
bundleId
optional
stringBundle 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โ€‹

Support for XCUITest (9.3+) Support for UiAutomator (4.2+)

  • 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โ€‹

NameTypeDetails
strategy
optional
stringhide keyboard strategy (UIAutomation only), available strategies - 'press', 'pressKey', 'swipeDown', 'tapOut', 'tapOutside', 'default'
key
optional
stringkey value if strategy is 'pressKey'
keyCode
optional
stringkey code if strategy is 'pressKey'
keyName
optional
stringkey name if strategy is 'pressKey'

Supportโ€‹

Support for XCUITest (9.3+), UIAutomation (8.0 to 9.3) Support for UiAutomator (4.2+) Support for Windows (10+)

  • 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โ€‹

Support for XCUITest (9.3+), UIAutomation (8.0 to 9.3) Support for UiAutomator (4.2+) Support for Windows (10+)

  • 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โ€‹

NameTypeDetails
pathstringpath to install the data to
datastringcontents of file in base64

Supportโ€‹

Support for XCUITest (9.3+), UIAutomation (8.0 to 9.3) Support for UiAutomator (4.2+) Support for Windows (10+)

  • 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โ€‹

NameTypeDetails
pathstringpath on the device to pull file from

Returnsโ€‹

  • <string> response: Contents of file in base64

Supportโ€‹

Support for XCUITest (9.3+), UIAutomation (8.0 to 9.3) Support for UiAutomator (4.2+) Support for Windows (10+)

  • 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โ€‹

NameTypeDetails
pathstringpath to an entire folder on the device

Returnsโ€‹

  • <string> response: Zip file of the folder contents in base64

Supportโ€‹

Support for XCUITest (9.3+), UIAutomation (8.0 to 9.3) Support for UiAutomator (4.2+) Support for Windows (10+)

  • 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โ€‹

Support for XCUITest (9.3+), UIAutomation (8.0 to 9.3) Support for UiAutomator (4.2+)

  • 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โ€‹

Support for XCUITest (9.3+), UIAutomation (8.0 to 9.3) Support for UiAutomator (4.2+) Support for Windows (10+)

  • 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โ€‹

NameTypeDetails
settingsobjectkey/value object with settings to update

Supportโ€‹

Support for XCUITest (9.3+), UIAutomation (8.0 to 9.3) Support for UiAutomator (4.2+) Support for Windows (10+)

  • 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โ€‹

NameTypeDetails
scriptstringThe script to execute. It has access to a 'driver' object which represents a WebdriverIO session attached to the current server.
type
optional
stringThe language/framework used in the script. Currently, only 'webdriverio' is supported and is the default.
timeout
optional
numberThe 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โ€‹

NameTypeDetails
type
optional
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โ€‹

Support for UiAutomator (4.2+) Support for XCUITest (9.3+)

  • 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โ€‹

NameTypeDetails
vendorstringName of the namespace (vendor) used to prefix the event
eventstringName of the event

Supportโ€‹

Support for UiAutomator (4.2+) Support for XCUITest (9.3+)

  • 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โ€‹

NameTypeDetails
modestringOne of possible comparison modes: 'matchFeatures', 'getSimilarity', 'matchTemplate'.
firstImagestringBase64-encoded image file.
secondImagestringBase64-encoded image file.
options=[object Object]
optional
objectThe 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 the mode and options values. 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โ€‹

Support for UiAutomator (4.2+)

  • 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โ€‹

Support for UiAutomator (4.2+)

  • 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โ€‹

Support for UiAutomator (4.2+)

  • 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โ€‹

Support for UiAutomator (4.2+)

  • 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โ€‹

NameTypeDetails
enginestringname of the engine to activate

Supportโ€‹

Support for UiAutomator (4.2+)

  • 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โ€‹

Support for UiAutomator (4.2+) Support for XCUITest (9.3+)

  • 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โ€‹

NameTypeDetails
orientationstringthe new browser orientation as defined in ScreenOrientation: LANDSCAPE|PORTRAIT

Supportโ€‹

Support for UiAutomator (4.2+) Support for XCUITest (9.3+)

  • 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โ€‹

NameTypeDetails
locationobjectthe new location ({latitude: number, longitude: number, altitude: number})

Supportโ€‹

Mobilecli engine (beta): not supported yet. Run tests that use this command with Appium.

Welcome! How can I help?

WebdriverIO AI Copilot