Skip to main content

Appium

getContext

Appium command. More details can be found in the official protocol docs.

Usage
driver.getContext()
Returns
  • <Context> context: a string representing the current context or null representing 'no context'

switchContext

Appium command. More details can be found in the official protocol docs.

Usage
driver.switchContext(name)
Parameters
NameTypeDetails
namestringa string representing an available context

getContexts

Appium command. More details can be found in the official protocol docs.

Usage
driver.getContexts()
Returns
  • <Context[]> contexts: an array of strings representing available contexts, e.g. 'WEBVIEW', or 'NATIVE'

shake

Perform a shake action on the device.

Appium command. More details can be found in the official protocol docs.

Usage
driver.shake()
Support

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


lock

Lock the device.

Appium command. More details can be found in the official protocol docs.

Usage
driver.lock(seconds)
Parameters
NameTypeDetails
seconds
optional
numberhow long to lock the screen (iOS only)
Support

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


unlock

Unlock the device.

Appium command. More details can be found in the official protocol docs.

Usage
driver.unlock()
Support

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


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

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


startRecordingScreen

Start recording the screen.

Appium command. More details can be found in the official protocol docs.

Usage
driver.startRecordingScreen(options)
Parameters
NameTypeDetails
options
optional
objectcommand 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

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


stopRecordingScreen

Stop recording screen

Appium command. More details can be found in the official protocol docs.

Usage
driver.stopRecordingScreen(remotePath, username, password, method)
Parameters
NameTypeDetails
remotePath
optional
stringThe 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
stringThe name of the user for the remote authentication.
password
optional
stringThe password for the remote authentication.
method
optional
stringThe 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

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


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

Support for UiAutomator (4.2+)


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
NameTypeDetails
packageNamestringthe package name of the application
dataTypestringthe type of system state which wants to read. It should be one of the supported performance data types
dataReadTimeout
optional
numberthe 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

Support for UiAutomator (4.2+)


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
NameTypeDetails
keycodenumberkeycode to press
metastate
optional
numbermeta state to press the keycode with
flags
optional
numberflags for the keypress
Support

Support for UiAutomator (4.2+)


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
NameTypeDetails
keycodenumberkeycode to press on the device
metastate
optional
numbermetastate for the keypress
flags
optional
numberflags for the keypress
Support

Support for UiAutomator (4.2+)


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
NameTypeDetails
keycodestringkeycode to press
metastate
optional
stringmeta state to press the keycode with
Support

Support for UiAutomator (4.2+)


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


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

Support for UiAutomator (4.2+)


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

Support for UiAutomator (4.2+)


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
NameTypeDetails
appPathstringpath to application .apk file
Support

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


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
NameTypeDetails
appIdstringApp ID (package ID for Android, bundle ID for iOS)
Support

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


removeApp

Remove an app from the device.

Appium command. More details can be found in the official protocol docs.

Usage
driver.removeApp(appId)
Parameters
NameTypeDetails
appIdstringApp ID (package ID for Android, bundle ID for iOS)
Support

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


terminateApp

Terminate the given app on the device

Appium command. More details can be found in the official protocol docs.

Usage
driver.terminateApp(appId)
Parameters
NameTypeDetails
appIdstringApp ID (package ID for Android, bundle ID for iOS)
Support

Support for XCUITest (9.3+) Support for 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
driver.isAppInstalled(appId)
Parameters
NameTypeDetails
appIdstringApp ID (package ID for Android, bundle ID 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+)


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
NameTypeDetails
appIdstringApp 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

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


hideKeyboard

Hide soft keyboard.

Appium command. More details can be found in the official protocol docs.

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


isKeyboardShown

Whether or not the soft keyboard is shown.

Appium command. More details can be found in the official protocol docs.

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


pushFile

Place a file onto the device in a particular place.

Appium command. More details can be found in the official protocol docs.

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


pullFile

Retrieve a file from the device's file system.

Appium command. More details can be found in the official protocol docs.

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


pullFolder

Retrieve a folder from the device's file system.

Appium command. More details can be found in the official protocol docs.

Usage
driver.pullFolder(path)
Parameters
NameTypeDetails
pathstringpath to an entire folder on the device
Support

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


toggleAirplaneMode

Toggle airplane mode on device.

Appium command. More details can be found in the official protocol docs.

Usage
driver.toggleAirplaneMode()
Support

Support for UiAutomator (4.2+)


toggleData

Switch the state of data service.

Appium command. More details can be found in the official protocol docs.

Usage
driver.toggleData()
Support

Support for UiAutomator (4.2+)


toggleWiFi

Switch the state of the wifi service.

Appium command. More details can be found in the official protocol docs.

Usage
driver.toggleWiFi()
Support

Support for UiAutomator (4.2+)


toggleLocationServices

Switch the state of the location service.

Appium command. More details can be found in the official protocol docs.

Usage
driver.toggleLocationServices()
Support

Support for UiAutomator (4.2+)


toggleNetworkSpeed

Set network speed (Emulator only)

Appium command. More details can be found in the official protocol docs.

Usage
driver.toggleNetworkSpeed(netspeed)
Parameters
NameTypeDetails
netspeedstringNetwork type - 'full','gsm', 'edge', 'hscsd', 'gprs', 'umts', 'hsdpa', 'lte', 'evdo'
Support

Support for UiAutomator (4.2+)


openNotifications

Open Android notifications (Emulator only).

Appium command. More details can be found in the official protocol docs.

Usage
driver.openNotifications()
Support

Support for UiAutomator (4.2+)


startActivity

Start an Android activity by providing package name and activity name.

Appium command. More details can be found in the official protocol docs.

Usage
driver.startActivity(appPackage, appActivity, appWaitPackage, appWaitActivity, intentAction, intentCategory, intentFlags, optionalIntentArguments, dontStopAppOnReset)
Parameters
NameTypeDetails
appPackagestringname of app
appActivitystringname of activity
appWaitPackage
optional
stringname of app to wait for
appWaitActivity
optional
stringname of activity to wait for
intentAction
optional
stringintent action which will be used to start activity
intentCategory
optional
stringintent category which will be used to start activity
intentFlags
optional
stringflags that will be used to start activity
optionalIntentArguments
optional
stringadditional intent arguments that will be used to start activity
dontStopAppOnReset
optional
stringdoesn’t stop the process of the app under test, before starting the app using adb
Support

Support for UiAutomator (4.2+)


getSystemBars

Retrieve visibility and bounds information of the status and navigation bars.

Appium command. More details can be found in the official protocol docs.

Usage
driver.getSystemBars()
Returns
  • <object[]> systemBars: Information about visibility and bounds of status and navigation bar
Support

Support for UiAutomator (4.2+)


getDeviceTime

Get the time on the device.

Appium command. More details can be found in the official protocol docs.

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


getDisplayDensity

Get display density from device.

Appium command. More details can be found in the official protocol docs.

Usage
driver.getDisplayDensity()
Returns
  • <*> displayDensity: undefined
Support

Support for UiAutomator (4.2+)


touchId

Simulate a touch id event (iOS Simulator only). To enable this feature, the allowTouchIdEnroll desired capability must be set to true and the Simulator must be enrolled. When you set allowTouchIdEnroll to true, it will set the Simulator to be enrolled by default. The enrollment state can be toggled. This call will only work if Appium process or its parent application (e.g. Terminal.app or Appium.app) has access to Mac OS accessibility in System Preferences > Security & Privacy > Privacy > Accessibility list.

Appium command. More details can be found in the official protocol docs.

Usage
driver.touchId(match)
Parameters
NameTypeDetails
matchbooleanare we simulating a successful touch (true) or a failed touch (false)
Support

Support for XCUITest (9.3+)


toggleEnrollTouchId

Toggle the simulator being enrolled to accept touchId (iOS Simulator only). To enable this feature, the allowTouchIdEnroll desired capability must be set to true. When allowTouchIdEnroll is set to true the Simulator will be enrolled by default, and the 'Toggle Touch ID Enrollment' changes the enrollment state. This call will only work if the Appium process or its parent application (e.g., Terminal.app or Appium.app) has access to Mac OS accessibility in System Preferences > Security & Privacy > Privacy > Accessibility list.

Appium command. More details can be found in the official protocol docs.

Usage
driver.toggleEnrollTouchId(enabled)
Parameters
NameTypeDetails
enabled
optional
booleanequals to true if TouchID enrollment should be enabled
Support

Support for XCUITest (9.3+)


launchApp

Launch an app on device.

Appium command. More details can be found in the official protocol docs.

caution

This protocol command is deprecated
For iOS, utilize driver.execute('mobile: launchApp', { ... }), and for Android, make use of driver.execute('mobile: activateApp', { ... }).

Usage
driver.launchApp()
Support

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


closeApp

Close an app on device.

Appium command. More details can be found in the official protocol docs.

caution

This protocol command is deprecated
Use driver.execute('mobile: terminateApp', { ... }) instead

Usage
driver.closeApp()
Support

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


background

Send the currently running app for this session to the background.

Appium command. More details can be found in the official protocol docs.

caution

This protocol command is deprecated
Use driver.execute('mobile: backgroundApp', { ... }) instead

Usage
driver.background(seconds)
Parameters
NameTypeDetails
secondsnumber, nulltimeout to restore app, if 'null' app won't be restored
Support

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


endCoverage

Get test coverage data.

Appium command. More details can be found in the official protocol docs.

Usage
driver.endCoverage(intent, path)
Parameters
NameTypeDetails
intentstringintent to broadcast
pathstringpath to .ec file
Support

Support for UiAutomator (4.2+)


getStrings

Get app strings.

Appium command. More details can be found in the official protocol docs.

Usage
driver.getStrings(language, stringFile)
Parameters
NameTypeDetails
language
optional
stringlanguage code
stringFile
optional
stringpath to the string file
Returns
  • <object> appStrings: all defined Strings from an app for the specified language and strings filename
Support

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


setValueImmediate

Appium command. More details can be found in the official protocol docs.

Usage
driver.setValueImmediate(elementId, text)
Parameters
NameTypeDetails
elementIdStringthe id of an element returned in a previous call to Find Element(s)
textstringtext to set to an element
Support

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


replaceValue

Replace the value to element directly.

Appium command. More details can be found in the official protocol docs.

Usage
driver.replaceValue(elementId, value)
Parameters
NameTypeDetails
elementIdStringthe id of an element returned in a previous call to Find Element(s)
valuestringvalue to replace on element
Support

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


getSettings

Retrieve the current settings on the device.

Appium command. More details can be found in the official protocol docs.

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


updateSettings

Update the current setting on the device.

Appium command. More details can be found in the official protocol docs.

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


receiveAsyncResponse

Callback url for asynchronous execution of JavaScript.

Appium command. More details can be found in the official protocol docs.

Usage
driver.receiveAsyncResponse(response)
Parameters
NameTypeDetails
responseobjectresponse to receive on device
Support

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


gsmCall

Make GSM call (Emulator only).

Appium command. More details can be found in the official protocol docs.

Usage
driver.gsmCall(phoneNumber, action)
Parameters
NameTypeDetails
phoneNumberstringthe phone number to call to
actionstringThe action - 'call', 'accept', 'cancel', 'hold'
Support

Support for UiAutomator (4.2+)


gsmSignal

Set GSM signal strength (Emulator only).

Appium command. More details can be found in the official protocol docs.

Usage
driver.gsmSignal(signalStrength, signalStrengh)
Parameters
NameTypeDetails
signalStrengthstringsignal strength in the range [0, 4]
signalStrengh
optional
stringsignal strength in the range [0, 4]. Please also set this parameter with the same value if you use Appium v1.11.0 or lower (see https://github.com/appium/appium/issues/12234).
Support

Support for UiAutomator (4.2+)


powerCapacity

Set the battery percentage (Emulator only).

Appium command. More details can be found in the official protocol docs.

Usage
driver.powerCapacity(percent)
Parameters
NameTypeDetails
percentnumberpercentage value in range [0, 100]
Support

Support for UiAutomator (4.2+)


powerAC

Set the state of the battery charger to connected or not (Emulator only).

Appium command. More details can be found in the official protocol docs.

Usage
driver.powerAC(state)
Parameters
NameTypeDetails
statestringset the state. on or off
Support

Support for UiAutomator (4.2+)


gsmVoice

Set GSM voice state (Emulator only).

Appium command. More details can be found in the official protocol docs.

Usage
driver.gsmVoice(state)
Parameters
NameTypeDetails
statestringstate of GSM voice - 'unregistered', 'home', 'roaming', 'searching', 'denied', 'off', 'on'
Support

Support for UiAutomator (4.2+)


sendSms

Simulate an SMS message (Emulator only).

Appium command. More details can be found in the official protocol docs.

Usage
driver.sendSms(phoneNumber, message)
Parameters
NameTypeDetails
phoneNumberstringthe phone number to send the SMS too
messagestringthe SMS message
Support

Support for UiAutomator (4.2+)


fingerPrint

Authenticate users by using their finger print scans on supported emulators.

Appium command. More details can be found in the official protocol docs.

Usage
driver.fingerPrint(fingerprintId)
Parameters
NameTypeDetails
fingerprintIdnumberfinger prints stored in Android Keystore system (from 1 to 10)
Support

Support for UiAutomator (4.2+)


setClipboard

Set the content of the system clipboard

Appium command. More details can be found in the official protocol docs.

Usage
driver.setClipboard(content, contentType, label)
Parameters
NameTypeDetails
contentstringThe actual base64 encoded clipboard content
contentType
optional
stringThe type of the content to get. Plaintext, Image, URL. Android supports only plaintext
label
optional
stringClipboard data label for Android
Returns
  • <string> response: Response from Appium server
Support

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


getClipboard

Get the content of the system clipboard

Appium command. More details can be found in the official protocol docs.

Usage
driver.getClipboard(contentType)
Parameters
NameTypeDetails
contentType
optional
stringThe type of the content to get. Plaintext, Image, URL. Android supports only plaintext
Returns
  • <string> response: Clipboard content as base64-encoded string or an empty string if the clipboard is empty
Support

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


touchPerform

This functionality is only available from within a native context. 'Touch Perform' works similarly to the other singular touch interactions, except that this allows you to chain together more than one touch action as one command. This is useful because Appium commands are sent over the network and there's latency between commands. This latency can make certain touch interactions impossible because some interactions need to be performed in one sequence. Vertical, for example, requires pressing down, moving to a different y coordinate, and then releasing. For it to work, there can't be a delay between the interactions.

Appium command. More details can be found in the official protocol docs.

Usage
driver.touchPerform(actions)
Parameters
NameTypeDetails
actionsobject[]The type of action to perform (e.g. moveTo, release, press, tap, wait)
Example
// do a horizontal swipe by percentage
const startPercentage = 10;
const endPercentage = 90;
const anchorPercentage = 50;

const { width, height } = driver.getWindowSize();
const anchor = height * anchorPercentage / 100;
const startPoint = width * startPercentage / 100;
const endPoint = width * endPercentage / 100;
driver.touchPerform([
{
action: 'press',
options: {
x: startPoint,
y: anchor,
},
},
{
action: 'wait',
options: {
ms: 100,
},
},
{
action: 'moveTo',
options: {
x: endPoint,
y: anchor,
},
},
{
action: 'release',
options: {},
},
]);
Support

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


multiTouchPerform

This functionality is only available from within a native context. Perform a multi touch action sequence.

Appium command. More details can be found in the official protocol docs.

Usage
driver.multiTouchPerform(actions)
Parameters
NameTypeDetails
actionsobject[]The type of action to perform (e.g. moveTo, release, press, tap, wait)
Support

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


executeDriverScript

This command enables you to specify a WebdriverIO script as a string and transmit it to the Appium server for local execution on the server itself. This approach helps minimize potential latency associated with each command. To utilize this command with Appium 2.0, you must have the execute-driver-plugin plugin installed.

Appium command. More details can be found in the official protocol docs.

Usage
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 stored in appium server.

Appium command. More details can be found in the official protocol docs.

Usage
driver.getEvents(type)
Parameters
NameTypeDetails
typestring[]Get events which are filtered with the type if the type is provided.
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+)


logEvent

Store a custom event.

Appium command. More details can be found in the official protocol docs.

Usage
driver.logEvent(vendor, event)
Parameters
NameTypeDetails
vendorstringThe name of vendor. It will be vendor in vendor:event.
eventstringThe name of event. It will be event in vendor:event.
Support

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


compareImages

This feature conducts image comparisons utilizing the capabilities of the OpenCV framework. Please note that for this functionality to work, both the OpenCV framework and the opencv4nodejs module must be installed on the machine where the Appium server is operational. Furthermore, you'll need to have the images-plugin plugin installed to use this feature with Appium 2.0.

Appium command. More details can be found in the official protocol docs.

Usage
driver.compareImages(mode, firstImage, secondImage, options)
Parameters
NameTypeDetails
modestringOne of possible comparison modes: 'matchFeatures', 'getSimilarity', 'matchTemplate'. 'matchFeatures' is by default.
firstImagestringAn image data. All image formats, that OpenCV library itself accepts, are supported.
secondImagestringAn image data. All image formats, that OpenCV library itself accepts, are supported.
optionsobjectThe content of this dictionary depends on the actual mode value. See the documentation on appium-support module for more details.
Returns
  • <object> result: The content of the resulting dictionary depends on the actual mode and options values. See the documentation on appium-support module for more details.

implicitWait

Set the amount of time the driver should wait when searching for elements. When searching for a single element, the driver should poll the page until an element is found or the timeout expires, whichever occurs first. When searching for multiple elements, the driver should poll the page until at least one element is found or the timeout expires, at which point it should return an empty list. If this command is never sent, the driver should default to an implicit wait of 0ms.

Appium command. More details can be found in the official protocol docs.

Usage
driver.implicitWait(ms)
Parameters
NameTypeDetails
msnumberThe amount of time, in milliseconds, to wait on an element.
Support

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


getLocationInView

Determine an element's location on the screen once it has been scrolled into view.

Note: This is considered an internal command and should only be used to determine an element's location for correctly generating native events.

Appium command. More details can be found in the official protocol docs.

Usage
driver.getLocationInView(elementId)
Parameters
NameTypeDetails
elementIdStringID of the element to route the command to
Returns
  • <Object> location: The X and Y coordinates for the element on the page.
Support

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


sendKeys

Send a sequence of key strokes to the active element

Appium command. More details can be found in the official protocol docs.

Usage
driver.sendKeys(value)
Parameters
NameTypeDetails
valuestring[]The sequence of keys to type. An array must be provided.
Support

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


availableIMEEngines

List all available engines on the machine. 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
driver.availableIMEEngines()
Returns
  • <String[]> engines: A list of available engines
Support

Support for 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
driver.getActiveIMEEngine()
Returns
  • <String> engine: The name of the active IME engine
Support

Support for 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
driver.isIMEActivated()
Returns
  • <Boolean> isActive: true if IME input is available and currently active, false otherwise
Support

Support for UiAutomator (4.2+)


deactivateIMEEngine

De-activates the currently-active IME engine.

Appium command. More details can be found in the official protocol docs.

Usage
driver.deactivateIMEEngine()
Support

Support for UiAutomator (4.2+)


activateIMEEngine

Make an engines that is available

Appium command. More details can be found in the official protocol docs.

Usage
driver.activateIMEEngine(engine)
Parameters
NameTypeDetails
enginestringname of the engine to activate
Support

Support for UiAutomator (4.2+)


asyncScriptTimeout

Set the amount of time, in milliseconds, that asynchronous scripts executed by /session/:sessionId/execute_async are permitted to run before they are aborted and a Timeout error is returned to the client.

Appium command. More details can be found in the official protocol docs.

Usage
driver.asyncScriptTimeout(ms)
Parameters
NameTypeDetails
msnumberThe amount of time, in milliseconds, that time-limited commands are permitted to run
Support

Support for XCUITest (9.3+)


submit

Submit a form element.

Appium command. More details can be found in the official protocol docs.

Usage
driver.submit(elementId)
Parameters
NameTypeDetails
elementIdStringID of the form element to be submitted
Support

Support for XCUITest (9.3+)


getElementSize

Determine an element's size in pixels. The size will be returned as a JSON object with width and height properties.

Appium command. More details can be found in the official protocol docs.

Usage
driver.getElementSize(elementId)
Parameters
NameTypeDetails
elementIdStringID of the element to route the command to
Returns
  • <Object> size: The width and height of the element, in pixels.
Support

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


getElementLocation

Determine an element's location on the page. The point (0, 0) refers to the upper-left corner of the page. The element's coordinates are returned as a JSON object with x and y properties.

Appium command. More details can be found in the official protocol docs.

Usage
driver.getElementLocation(elementId)
Parameters
NameTypeDetails
elementIdStringID of the element to route the command to
Returns
  • <Object> location: The X and Y coordinates for the element on the page.
Support

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


touchClick

Single tap on the touch enabled device.

Appium command. More details can be found in the official protocol docs.

Usage
driver.touchClick(element)
Parameters
NameTypeDetails
elementstringID of the element to single tap on.
Support

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


touchDown

Finger down on the screen.

Appium command. More details can be found in the official protocol docs.

Usage
driver.touchDown(x, y)
Parameters
NameTypeDetails
xnumberx coordinate on the screen
ynumbery coordinate on the screen
Support

Support for UiAutomator (4.2+)


touchUp

Finger up on the screen.

Appium command. More details can be found in the official protocol docs.

Usage
driver.touchUp(x, y)
Parameters
NameTypeDetails
xnumberx coordinate on the screen
ynumbery coordinate on the screen
Support

Support for UiAutomator (4.2+)


touchMove

Finger move on the screen.

Appium command. More details can be found in the official protocol docs.

Usage
driver.touchMove(x, y)
Parameters
NameTypeDetails
xnumberx coordinate on the screen
ynumbery coordinate on the screen
Support

Support for UiAutomator (4.2+)


touchLongClick

Long press on the touch screen using finger motion events.

Appium command. More details can be found in the official protocol docs.

Usage
driver.touchLongClick(element)
Parameters
NameTypeDetails
elementstringID of the element to long press on
Support

Support for UiAutomator (4.2+)


touchFlick

Flick on the touch screen using finger motion events. This flick command starts at a particular screen location.

Appium command. More details can be found in the official protocol docs.

Usage
driver.touchFlick(xoffset, yoffset, element, speed, xspeed, yspeed)
Parameters
NameTypeDetails
xoffset
optional
numberthe x offset in pixels to flick by
yoffset
optional
numberthe y offset in pixels to flick by
element
optional
stringID of the element where the flick starts
speed
optional
numberthe speed in pixels per seconds
xspeed
optional
numberthe x speed in pixels per second
yspeed
optional
numberthe y speed in pixels per second
Support

Support for UiAutomator (4.2+)


getOrientation

Get the current device orientation.

Appium command. More details can be found in the official protocol docs.

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


setOrientation

Set the device orientation

Appium command. More details can be found in the official protocol docs.

Usage
driver.setOrientation(orientation)
Parameters
NameTypeDetails
orientationstringthe new browser orientation as defined in ScreenOrientation: `LANDSCAPE
Support

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


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
NameTypeDetails
typestringthe log type
Returns
  • <Object[]> logs: The list of log entries.
Support

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


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.
Support

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

Welcome! How can I help?

WebdriverIO AI Copilot