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.

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.

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.

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

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

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+)

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+)

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+)

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+)

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+)

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+)

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+)

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+)

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+)

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+)

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+)

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+)

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+)

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+)

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+)

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+)

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+)

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.

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+)

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+)

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.

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+)

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+)

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+)

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+)

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+)

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+)

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+)

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.

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})

Welcome! How can I help?

WebdriverIO AI Copilot