Appium
getLogTypesโ
Get available log types.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.getLogTypes()
Returnsโ
- <String[]>
logTypes
: The list of available log types, example: browser, driver.
getLogsโ
Get the log for a given log type. Log buffer is reset after each request.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.getLogs(type)
Parametersโ
Name | Type | Details |
---|---|---|
type | string | the log type |
Returnsโ
- <Object[]>
logs
: The list of log entries.
getSessionโ
Retrieve the capabilities of the current session.
Appium command. More details can be found in the official protocol docs.
This protocol command is deprecated
Use getAppiumSessionCapabilities
instead
Usageโ
driver.getSession()
Returnsโ
- <Object>
capabilities
: An object describing the session's capabilities.
getAppiumContextโ
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.getAppiumContext()
Returnsโ
- <Context>
context
: a string representing the current context or null representing 'no context'
switchAppiumContextโ
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.switchAppiumContext(name)
Parametersโ
Name | Type | Details |
---|---|---|
name | string | a string representing an available context |
getAppiumContextsโ
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.getAppiumContexts()
Returnsโ
- <Context[]>
contexts
: an array of strings representing available contexts, e.g. 'WEBVIEW', or 'NATIVE'
getAppiumCommandsโ
Retrieve the endpoints and BiDi commands supported in the current session.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.getAppiumCommands()
Returnsโ
- <Object>
commands
: Supported endpoints and BiDi commands, each grouped into common, driver-specific, and plugin-specific endpoints/commands.
getAppiumExtensionsโ
Retrieve the extension commands supported in the current session.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.getAppiumExtensions()
Returnsโ
- <Object>
commands
: Supported extension commands, grouped into driver-specific and plugin-specific commands.
getAppiumSessionCapabilitiesโ
Retrieve the capabilities of the current session.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.getAppiumSessionCapabilities()
Returnsโ
- <Object>
capabilities
: An object describing the session's capabilities.
shakeโ
Perform a shake action on the device.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.shake()
Supportโ
lockโ
Lock the device.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.lock(seconds)
Parametersโ
Name | Type | Details |
---|---|---|
seconds optional | number | how long to lock the screen (iOS only) |
Supportโ
unlockโ
Unlock the device.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.unlock()
Supportโ
isLockedโ
Check whether the device is locked or not.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.isLocked()
Returnsโ
- <boolean>
isLocked
: True if the device is locked, false if not
Supportโ
startRecordingScreenโ
Start recording the screen.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.startRecordingScreen(options)
Parametersโ
Name | Type | Details |
---|---|---|
options optional | object | command parameters that can contain keys like: remotePath, username, password, method, forceRestart, timeLimit, videoType, videoQuality, videoFps, bitRate, videoSize, bugReport (see more description in Appium docs) |
Supportโ
stopRecordingScreenโ
Stop recording screen
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.stopRecordingScreen(remotePath, username, password, method)
Parametersโ
Name | Type | Details |
---|---|---|
remotePath optional | string | The path to the remote location, where the resulting video should be uploaded. The following protocols are supported http/https, ftp. This option only has an effect if there is screen recording process in progreess and forceRestart parameter is not set to true. Null or empty string value (the default setting) means the content of resulting file should be encoded as Base64. |
username optional | string | The name of the user for the remote authentication. |
password optional | string | The password for the remote authentication. |
method optional | string | The http multipart upload method name. The 'PUT' one is used by default. |
Returnsโ
- <string>
response
: Base64 encoded string. If remote_path is set, the response is empty string
Supportโ
getPerformanceDataTypesโ
Returns the information types of the system state which is supported to read as like cpu, memory, network traffic, and battery.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.getPerformanceDataTypes()
Returnsโ
- <string[]>
performanceTypes
: The available performance data types (cpuinfo|batteryinfo|networkinfo|memoryinfo)
Supportโ
getPerformanceDataโ
Returns the information of the system state which is supported to read as like cpu, memory, network traffic, and battery.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.getPerformanceData(packageName, dataType, dataReadTimeout)
Parametersโ
Name | Type | Details |
---|---|---|
packageName | string | the package name of the application |
dataType | string | the type of system state which wants to read. It should be one of the supported performance data types |
dataReadTimeout optional | number | the number of attempts to read |
Returnsโ
- <string[]>
performanceData
: The information type of the system state which is supported to read as like cpu, memory, network traffic, and battery
Supportโ
pressKeyCodeโ
Press a particular key on the device.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.pressKeyCode(keycode, metastate, flags)
Parametersโ
Name | Type | Details |
---|---|---|
keycode | number | keycode to press |
metastate optional | number | meta state to press the keycode with |
flags optional | number | flags for the keypress |
Supportโ
longPressKeyCodeโ
Press and hold a particular key code on the device.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.longPressKeyCode(keycode, metastate, flags)
Parametersโ
Name | Type | Details |
---|---|---|
keycode | number | keycode to press on the device |
metastate optional | number | metastate for the keypress |
flags optional | number | flags for the keypress |
Supportโ
sendKeyEventโ
Send a key code to the device.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.sendKeyEvent(keycode, metastate)
Parametersโ
Name | Type | Details |
---|---|---|
keycode | string | keycode to press |
metastate optional | string | meta state to press the keycode with |
Supportโ
rotateDeviceโ
Rotate the device in three dimensions.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.rotateDevice(x, y, z)
Parametersโ
Name | Type | Details |
---|---|---|
x | number | x offset to use for the center of the rotate gesture |
y | number | y offset to use for the center of the rotate gesture |
z | number | z offset to use for the center of the rotate gesture |
Supportโ
getCurrentActivityโ
Get the name of the current Android activity.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.getCurrentActivity()
Returnsโ
- <string>
activity
: Name of the current activity
Supportโ
getCurrentPackageโ
Get the name of the current Android package.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.getCurrentPackage()
Returnsโ
- <string>
package
: Name of the current package
Supportโ
installAppโ
Install the given app onto the device.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.installApp(appPath)
Parametersโ
Name | Type | Details |
---|---|---|
appPath | string | path to application .apk file |
Supportโ
activateAppโ
Activate the given app onto the device
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.activateApp(appId)
Parametersโ
Name | Type | Details |
---|---|---|
appId | string | App ID (package ID for Android, bundle ID for iOS) |
Supportโ
removeAppโ
Remove an app from the device.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.removeApp(appId)
Parametersโ
Name | Type | Details |
---|---|---|
appId | string | App ID (package ID for Android, bundle ID for iOS) |
Supportโ
terminateAppโ
Terminate the given app on the device
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.terminateApp(appId, options)
Parametersโ
Name | Type | Details |
---|---|---|
appId | string | App ID (package ID for Android, bundle ID for iOS) |
options optional | object | Command options. E.g. "timeout": (Only Android) Timeout to retry terminate the app (see more in Appium docs) |
Supportโ
isAppInstalledโ
Check whether the specified app is installed on the device.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.isAppInstalled(appId)
Parametersโ
Name | Type | Details |
---|---|---|
appId | string | App ID (package ID for Android, bundle ID for iOS) |
Returnsโ
- <boolean>
isAppInstalled
: Return true if installed, false if not
Supportโ
queryAppStateโ
Get the given app status on the device
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.queryAppState(appId)
Parametersโ
Name | Type | Details |
---|---|---|
appId | string | App ID (package ID for Android, bundle ID for iOS) |
Returnsโ
- <number>
appStatus
: 0 is not installed. 1 is not running. 2 is running in background or suspended. 3 is running in background. 4 is running in foreground
Supportโ
hideKeyboardโ
Hide soft keyboard.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.hideKeyboard(strategy, key, keyCode, keyName)
Parametersโ
Name | Type | Details |
---|---|---|
strategy optional | string | hide keyboard strategy (UIAutomation only), available strategies - 'press', 'pressKey', 'swipeDown', 'tapOut', 'tapOutside', 'default' |
key optional | string | key value if strategy is 'pressKey' |
keyCode optional | string | key code if strategy is 'pressKey' |
keyName optional | string | key name if strategy is 'pressKey' |
Supportโ
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โ
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โ
Name | Type | Details |
---|---|---|
path | string | path to install the data to |
data | string | contents of file in base64 |
Supportโ
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โ
Name | Type | Details |
---|---|---|
path | string | path on the device to pull file from |
Returnsโ
- <string>
response
: Contents of file in base64
Supportโ
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โ
Name | Type | Details |
---|---|---|
path | string | path to an entire folder on the device |
Supportโ
toggleAirplaneModeโ
Toggle airplane mode on device.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.toggleAirplaneMode()
Supportโ
toggleDataโ
Switch the state of data service.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.toggleData()
Supportโ
toggleWiFiโ
Switch the state of the wifi service.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.toggleWiFi()
Supportโ
toggleLocationServicesโ
Switch the state of the location service.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.toggleLocationServices()
Supportโ
toggleNetworkSpeedโ
Set network speed (Emulator only)
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.toggleNetworkSpeed(netspeed)
Parametersโ
Name | Type | Details |
---|---|---|
netspeed | string | Network type - 'full','gsm', 'edge', 'hscsd', 'gprs', 'umts', 'hsdpa', 'lte', 'evdo' |
Supportโ
openNotificationsโ
Open Android notifications (Emulator only).
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.openNotifications()
Supportโ
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โ
Name | Type | Details |
---|---|---|
appPackage | string | name of app |
appActivity | string | name of activity |
appWaitPackage optional | string | name of app to wait for |
appWaitActivity optional | string | name of activity to wait for |
intentAction=android.intent.action.MAIN optional | string | intent action which will be used to start activity |
intentCategory=android.intent.category.LAUNCHER optional | string | intent category which will be used to start activity |
intentFlags=0x10200000 optional | string | flags that will be used to start activity |
optionalIntentArguments optional | string | additional intent arguments that will be used to start activity |
dontStopAppOnReset optional | string | doesnโt stop the process of the app under test, before starting the app using adb |
Supportโ
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โ
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โ
getDisplayDensityโ
Get display density from device.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.getDisplayDensity()
Returnsโ
- <*>
Supportโ
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โ
Name | Type | Details |
---|---|---|
match | boolean | are we simulating a successful touch (true) or a failed touch (false) |
Supportโ
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โ
Name | Type | Details |
---|---|---|
enabled=true optional | boolean | equals to true if TouchID enrollment should be enabled |
Supportโ
launchAppโ
Launch an app on device.
Appium command. More details can be found in the official protocol docs.
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โ
closeAppโ
Close an app on device.
Appium command. More details can be found in the official protocol docs.
This protocol command is deprecated
Use driver.execute('mobile: terminateApp', { ... })
instead
Usageโ
driver.closeApp()
Supportโ
backgroundโ
Send the currently running app for this session to the background.
Appium command. More details can be found in the official protocol docs.
This protocol command is deprecated
Use driver.execute('mobile: backgroundApp', { ... })
instead
Usageโ
driver.background(seconds)
Parametersโ
Name | Type | Details |
---|---|---|
seconds=null | number, null | timeout to restore app, if 'null' app won't be restored |
Supportโ
endCoverageโ
Get test coverage data.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.endCoverage(intent, path)
Parametersโ
Name | Type | Details |
---|---|---|
intent | string | intent to broadcast |
path | string | path to .ec file |
Supportโ
getStringsโ
Get app strings.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.getStrings(language, stringFile)
Parametersโ
Name | Type | Details |
---|---|---|
language optional | string | language code |
stringFile optional | string | path to the string file |
Returnsโ
- <object>
appStrings
: all defined Strings from an app for the specified language and strings filename
Supportโ
setValueImmediateโ
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.setValueImmediate(elementId, text)
Parametersโ
Name | Type | Details |
---|---|---|
elementId | String | the id of an element returned in a previous call to Find Element(s) |
text | string | text to set to an element |
Supportโ
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โ
Name | Type | Details |
---|---|---|
elementId | String | the id of an element returned in a previous call to Find Element(s) |
value | string | value to replace on element |
Supportโ
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โ
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โ
Name | Type | Details |
---|---|---|
settings | object | key/value object with settings to update |
Supportโ
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โ
Name | Type | Details |
---|---|---|
response | object | response to receive on device |
Supportโ
gsmCallโ
Make GSM call (Emulator only).
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.gsmCall(phoneNumber, action)
Parametersโ
Name | Type | Details |
---|---|---|
phoneNumber | string | the phone number to call to |
action | string | The action - 'call', 'accept', 'cancel', 'hold' |
Supportโ
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โ
Name | Type | Details |
---|---|---|
signalStrength | string | signal strength in the range [0, 4] |
signalStrengh optional | string | signal 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โ
powerCapacityโ
Set the battery percentage (Emulator only).
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.powerCapacity(percent)
Parametersโ
Name | Type | Details |
---|---|---|
percent | number | percentage value in range [0, 100] |
Supportโ
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โ
Name | Type | Details |
---|---|---|
state | string | set the state. on or off |
Supportโ
gsmVoiceโ
Set GSM voice state (Emulator only).
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.gsmVoice(state)
Parametersโ
Name | Type | Details |
---|---|---|
state | string | state of GSM voice - 'unregistered', 'home', 'roaming', 'searching', 'denied', 'off', 'on' |
Supportโ
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โ
Name | Type | Details |
---|---|---|
phoneNumber | string | the phone number to send the SMS too |
message | string | the SMS message |
Supportโ
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โ
Name | Type | Details |
---|---|---|
fingerprintId | number | finger prints stored in Android Keystore system (from 1 to 10) |
Supportโ
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โ
Name | Type | Details |
---|---|---|
content | string | The actual base64 encoded clipboard content |
contentType optional | string | The type of the content to get. Plaintext, Image, URL. Android supports only plaintext |
label optional | string | Clipboard data label for Android |
Returnsโ
- <string>
response
: Response from Appium server
Supportโ
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โ
Name | Type | Details |
---|---|---|
contentType optional | string | The 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โ
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โ
Name | Type | Details |
---|---|---|
actions | object[] | 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โ
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โ
Name | Type | Details |
---|---|---|
actions | object[] | The type of action to perform (e.g. moveTo, release, press, tap, wait) |
Supportโ
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โ
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. |
type optional | string | The language/framework used in the script. Currently, only 'webdriverio' is supported and is the default. |
timeout optional | 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.
getEventsโ
Get events stored in appium server.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.getEvents(type)
Parametersโ
Name | Type | Details |
---|---|---|
type | string[] | 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โ
logEventโ
Store a custom event.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.logEvent(vendor, event)
Parametersโ
Name | Type | Details |
---|---|---|
vendor | string | The name of vendor. It will be vendor in vendor:event . |
event | string | The name of event. It will be event in vendor:event . |
Supportโ
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โ
Name | Type | Details |
---|---|---|
mode=matchFeatures | string | One of possible comparison modes: 'matchFeatures', 'getSimilarity', 'matchTemplate'. 'matchFeatures' is by default. |
firstImage | string | An image data. All image formats, that OpenCV library itself accepts, are supported. |
secondImage | string | An image data. All image formats, that OpenCV library itself accepts, are supported. |
options=[object Object] | object | The 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 actualmode
andoptions
values. See the documentation onappium-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โ
Name | Type | Details |
---|---|---|
ms | number | The amount of time, in milliseconds, to wait on an element. |
Supportโ
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โ
Name | Type | Details |
---|---|---|
elementId | String | ID of the element to route the command to |
Returnsโ
- <Object>
location
: The X and Y coordinates for the element on the page.
Supportโ
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โ
Name | Type | Details |
---|---|---|
value | string[] | The sequence of keys to type. An array must be provided. |
Supportโ
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โ
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โ
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โ
deactivateIMEEngineโ
De-activates the currently-active IME engine.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.deactivateIMEEngine()
Supportโ
activateIMEEngineโ
Make an engines that is available
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.activateIMEEngine(engine)
Parametersโ
Name | Type | Details |
---|---|---|
engine | string | name of the engine to activate |
Supportโ
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โ
Name | Type | Details |
---|---|---|
ms | number | The amount of time, in milliseconds, that time-limited commands are permitted to run |
Supportโ
submitโ
Submit a form element.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.submit(elementId)
Parametersโ
Name | Type | Details |
---|---|---|
elementId | String | ID of the form element to be submitted |
Supportโ
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โ
Name | Type | Details |
---|---|---|
elementId | String | ID of the element to route the command to |
Returnsโ
- <Object>
size
: The width and height of the element, in pixels.
Supportโ
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โ
Name | Type | Details |
---|---|---|
elementId | String | ID of the element to route the command to |
Returnsโ
- <Object>
location
: The X and Y coordinates for the element on the page.
Supportโ
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โ
Name | Type | Details |
---|---|---|
element | string | ID of the element to single tap on. |
Supportโ
touchDownโ
Finger down on the screen.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.touchDown(x, y)
Parametersโ
Name | Type | Details |
---|---|---|
x | number | x coordinate on the screen |
y | number | y coordinate on the screen |
Supportโ
touchUpโ
Finger up on the screen.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.touchUp(x, y)
Parametersโ
Name | Type | Details |
---|---|---|
x | number | x coordinate on the screen |
y | number | y coordinate on the screen |
Supportโ
touchMoveโ
Finger move on the screen.
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.touchMove(x, y)
Parametersโ
Name | Type | Details |
---|---|---|
x | number | x coordinate on the screen |
y | number | y coordinate on the screen |
Supportโ
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โ
Name | Type | Details |
---|---|---|
element | string | ID of the element to long press on |
Supportโ
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โ
Name | Type | Details |
---|---|---|
xoffset optional | number | the x offset in pixels to flick by |
yoffset optional | number | the y offset in pixels to flick by |
element optional | string | ID of the element where the flick starts |
speed optional | number | the speed in pixels per seconds |
xspeed optional | number | the x speed in pixels per second |
yspeed optional | number | the y speed in pixels per second |
Supportโ
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โ
setOrientationโ
Set the device orientation
Appium command. More details can be found in the official protocol docs.
Usageโ
driver.setOrientation(orientation)
Parametersโ
Name | Type | Details |
---|---|---|
orientation | string | the new browser orientation as defined in ScreenOrientation: LANDSCAPE|PORTRAIT |
Supportโ
getGeoLocationโ
Get the current geo location.
Appium command. More details can be found in the official protocol docs.
Usageโ
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โ
driver.setGeoLocation(location)
Parametersโ
Name | Type | Details |
---|---|---|
location | object | the new location ({latitude: number, longitude: number, altitude: number} ) |