Skip to content

AppiumDriver

This is a JavaScript wrapper for AppiumDriver of AppiumDotNet library.
https://github.com/appium/appium-dotnet-driver

Action Summary

Action Description
Actions Gets Actions object.
ActivateApp Activates an application by it's ID.
ActivateIMEEngine Activate the given IME on the device.
BackgroundApp Send the currently active app to the background, and either return after a certain amount of time, or leave the app deactivated.
ClearSavedSession Clears saved Appium session to start a new one.
ClearSessions Deletes active sessions on Appium server.
Close Close the Browser and Dispose of WebDriver.
CloseApp Close the application.
CreateAppiumDriver Connects to a mobile target using given Appium uri and capabilities.
CreateDesiredCapabilities
CreateDriverForSession Connects to active Appium session with given URL and Id.
CreatePointerInput Gets PointerInputDevice object.
CreateTouchAction Gets TouchAction object.
DeactiveIMEEngine Deactivate the currently Active IME Engine on the device.
Dispose Dispose of WebDriver.
DoSendKeys Sends keys to an active element.
DumpSessions Prints information about active Appium sessions to output.
ExecuteScript Executes JavaScript in the context of the currently selected frame or window.
FindElementByAccessibilityId Search for an element using Accessibility ID.
FindElementByAndroidUIAutomator Search for an element using UIAutomator selector.
FindElementByClassName Finds the first element in the page that matches the CSS Class supplied.
FindElementByCssSelector Finds the first element matching the specified CSS selector.
FindElementById Finds the first element in the page that matches the ID supplied.
FindElementByIosUIAutomation Search for an element using UIAutomation selector.
FindElementByLinkText Finds the first of elements that match the link text supplied.
FindElementByName Finds the first of elements that match the name supplied.
FindElementByPartialLinkText Finds the first of elements that match the part of the link text supplied.
FindElementByTagName Finds the first of elements that match the DOM Tag supplied.
FindElementByXPath Finds the first of elements that match the XPath supplied.
FindElementsByAccessibilityId Search for all elements matching Accessibility ID.
FindElementsByAndroidUIAutomator Search for all elements using UIAutomator selector.
FindElementsByClassName Finds a list of elements that match the class name supplied.
FindElementsByCssSelector Finds all elements matching the specified CSS selector.
FindElementsById Finds the first element in the page that matches the ID supplied.
FindElementsByIosUIAutomation Search for all elements using UIAutomation selector.
FindElementsByLinkText Finds a list of elements that match the link text supplied.
FindElementsByName Finds a list of elements that match the name supplied.
FindElementsByPartialLinkText Finds a list of elements that match the part of the link text supplied.
FindElementsByTagName Finds a list of elements that match the DOM Tag supplied.
FindElementsByXPath Finds a list of elements that match the XPath supplied.
GetAddressOfRemoteServer
GetContext
GetContexts
GetCurrentActivity
GetCurrentWindowHandle Gets the current window handle, which is an opaque handle to this window that uniquely identifies it within this driver instance.
GetIMEActiveEngine
GetIMEAvailableEngines
GetOrientation
GetPageSource Gets the source of the page last loaded by the browser.
GetSessionId
GetTitle Gets the title of the current browser window.
GetUrl Gets the URL the browser is currently displaying.
GetWindowHandles Gets the window handles of open browser windows.
HideKeyboard Hide soft keyboard
IgnoreUnimportantViews This capability can speed up test execution, since Accessibility commands will run faster ignoring some elements.
InstallApp Install the given app onto the device.
IsAppInstalled Check whether the specified app is installed on the device.
IsIMEActive Check if IME is active.
IsLocked Check whether the device is locked or not
LaunchApp Launch the app-under-test on the device
OpenNotifications Open Android notifications (Emulator only)
PerformActions Performs W3C actions.
PressKeyCode Press a particular key on Device
PullFile Retrieve a file from the device's file system.
PushFile Place a file onto the device in a particular place.
Quit Disconnects from the Browser.
ReconnectSession Reads session information produced by SaveSession and connects to the mobile target.
RemoveApp Remove an app from the device
ResetApp Reset the currently running app for this session
SaveSession Saves session information for use by ReconnectSession.
SeSFind Finds an element given it's locator string.
SetContext Sets current context.
SetOrientation Sets device orienataion.
SetUrl Sets the URL the browser is currently displaying.
ShakeDevice Perform a shake action on the device
StartActivity Start an Android activity by providing package name and activity name
StartRecordingScreen Starts video recording on a device.
StopRecordingScreen Stops video recording on a device.
ToggleAirplaneMode Toggle airplane mode on device
ToggleLocationServices Switch the state of the location service
ToggleWifi Switch the state of the WiFi service

Action Detail

Actions

Gets Actions object.

AppiumDriver.Actions()

ActivateApp

Activates an application by it's ID. Find iOS default application IDs here. For Android application ID is Package Name, e.g. com.android.chrome.

AppiumDriver.ActivateApp(appId)

Parameters:

Name Type Description
appId string ID of an application to activate.

ActivateIMEEngine

Activate the given IME on the device.

AppiumDriver.ActivateIMEEngine(imeEngine)

Parameters:

Name Type Description
imeEngine string IME to activate

BackgroundApp

Send the currently active app to the background, and either return after a certain amount of time, or leave the app deactivated.

AppiumDriver.BackgroundApp(seconds)

Parameters:

Name Type Description
seconds number Timeout value

ClearSavedSession

Clears saved Appium session to start a new one. Requires Rapise 8.0+.

AppiumDriver.ClearSavedSession()

ClearSessions

Deletes active sessions on Appium server.

AppiumDriver.ClearSessions()

Close

Close the Browser and Dispose of WebDriver.

AppiumDriver.Close()

CloseApp

Close the application.

AppiumDriver.CloseApp()

CreateAppiumDriver

Connects to a mobile target using given Appium uri and capabilities.

AppiumDriver.CreateAppiumDriver(uri, caps)

Parameters:

Name Type Description
uri string Appium server URL.
caps AppiumCapabilities DesiredCapabilities object with key/value pairs.

Returns:

Driver object.

CreateDesiredCapabilities

AppiumDriver.CreateDesiredCapabilities()

Returns:

AppiumCapabilities object.

CreateDriverForSession

Connects to active Appium session with given URL and Id.

AppiumDriver.CreateDriverForSession(addressOfRemoteServer, sessionId, suppressErrors)

Parameters:

Name Type Description
addressOfRemoteServer string Appium server URL.
sessionId string Id of the session to connect.
suppressErrors boolean 'true' to suppress failures in the report, default 'false'.
Optional, Default: "false".

Returns:

true if successful, false otherwise.

CreatePointerInput

Gets PointerInputDevice object. Requires Rapise 8.2+.

var element = AppiumDriver.FindElementByXPath("//*[@text='Login']");
var p = AppiumDriver.CreatePointerInput("Touch", "finger");
var sequence = p.CreateActionSequence(p);
var move = p.CreatePointerMoveElement(element, 0, 0, 0);
var actionPress = p.CreatePointerDown("Touch");
var pause = p.CreatePause(50);
var actionRelease = p.CreatePointerUp("Touch");

sequence.AddAction(move);
sequence.AddAction(actionPress);
sequence.AddAction(pause);
sequence.AddAction(actionRelease);

AppiumDriver.PerformActions(sequence);
AppiumDriver.CreatePointerInput(kind, name)

Parameters:

Name Type Description
kind string Touch, Mouse or Pen.
name string Name of the pointer device. Whatever you like.

CreateTouchAction

Gets TouchAction object. Requires Rapise 8.0+.

AppiumDriver.CreateTouchAction()

DeactiveIMEEngine

Deactivate the currently Active IME Engine on the device.

AppiumDriver.DeactiveIMEEngine()

Dispose

Dispose of WebDriver.

AppiumDriver.Dispose()

DoSendKeys

Sends keys to an active element. Requires Rapise 8.1+.

AppiumDriver.DoSendKeys(txt)

Parameters:

Name Type Description
txt string Keys to send. Supports patterns like in Global.DoSendKeys.

DumpSessions

Prints information about active Appium sessions to output.

AppiumDriver.DumpSessions()

ExecuteScript

Executes JavaScript in the context of the currently selected frame or window.

AppiumDriver.ExecuteScript(script, args)

Parameters:

Name Type Description
script string The JavaScript code to execute.
args array The arguments to the script.

FindElementByAccessibilityId

Search for an element using Accessibility ID.

AppiumDriver.FindElementByAccessibilityId(selector)

Parameters:

Name Type Description
selector string Element selector

FindElementByAndroidUIAutomator

Search for an element using UIAutomator selector.

AppiumDriver.FindElementByAndroidUIAutomator(selector)

Parameters:

Name Type Description
selector string Element selector

FindElementByClassName

Finds the first element in the page that matches the CSS Class supplied.

AppiumDriver.FindElementByClassName(className)

Parameters:

Name Type Description
className string CSS class name of the element.

FindElementByCssSelector

Finds the first element matching the specified CSS selector.

AppiumDriver.FindElementByCssSelector(cssSelector)

Parameters:

Name Type Description
cssSelector string The CSS selector to match.

FindElementById

Finds the first element in the page that matches the ID supplied.

AppiumDriver.FindElementById(id)

Parameters:

Name Type Description
id string ID of the element.

FindElementByIosUIAutomation

Search for an element using UIAutomation selector.

AppiumDriver.FindElementByIosUIAutomation(selector)

Parameters:

Name Type Description
selector string Element selector

FindElementByLinkText

Finds the first of elements that match the link text supplied.

AppiumDriver.FindElementByLinkText(linkText)

Parameters:

Name Type Description
linkText string Link text of element.

FindElementByName

Finds the first of elements that match the name supplied.

AppiumDriver.FindElementByName(name)

Parameters:

Name Type Description
name string Name of the element on the page.

FindElementByPartialLinkText

Finds the first of elements that match the part of the link text supplied.

AppiumDriver.FindElementByPartialLinkText(partialLinkText)

Parameters:

Name Type Description
partialLinkText string Part of the link text.

FindElementByTagName

Finds the first of elements that match the DOM Tag supplied.

AppiumDriver.FindElementByTagName(tagName)

Parameters:

Name Type Description
tagName string DOM tag Name of the element being searched.

FindElementByXPath

Finds the first of elements that match the XPath supplied.

AppiumDriver.FindElementByXPath(xpath)

Parameters:

Name Type Description
xpath string xpath to the element.

FindElementsByAccessibilityId

Search for all elements matching Accessibility ID.

AppiumDriver.FindElementsByAccessibilityId(selector)

Parameters:

Name Type Description
selector string Element selector

FindElementsByAndroidUIAutomator

Search for all elements using UIAutomator selector.

AppiumDriver.FindElementsByAndroidUIAutomator(selector)

Parameters:

Name Type Description
selector string Element selector

FindElementsByClassName

Finds a list of elements that match the class name supplied.

AppiumDriver.FindElementsByClassName(className)

Parameters:

Name Type Description
className string class name of the element.

FindElementsByCssSelector

Finds all elements matching the specified CSS selector.

AppiumDriver.FindElementsByCssSelector(cssSelector)

Parameters:

Name Type Description
cssSelector string The CSS selector to match.

FindElementsById

Finds the first element in the page that matches the ID supplied.

AppiumDriver.FindElementsById(id)

Parameters:

Name Type Description
id string ID of the element.

FindElementsByIosUIAutomation

Search for all elements using UIAutomation selector.

AppiumDriver.FindElementsByIosUIAutomation(selector)

Parameters:

Name Type Description
selector string Element selector

FindElementsByLinkText

Finds a list of elements that match the link text supplied.

AppiumDriver.FindElementsByLinkText(linkText)

Parameters:

Name Type Description
linkText string Link text of element.

FindElementsByName

Finds a list of elements that match the name supplied.

AppiumDriver.FindElementsByName(name)

Parameters:

Name Type Description
name string Name of the element on the page.

FindElementsByPartialLinkText

Finds a list of elements that match the part of the link text supplied.

AppiumDriver.FindElementsByPartialLinkText(partialLinkText)

Parameters:

Name Type Description
partialLinkText string Part of the link text.

FindElementsByTagName

Finds a list of elements that match the DOM Tag supplied.

AppiumDriver.FindElementsByTagName(tagName)

Parameters:

Name Type Description
tagName string DOM tag Name of the element being searched.

FindElementsByXPath

Finds a list of elements that match the XPath supplied.

AppiumDriver.FindElementsByXPath(xpath)

Parameters:

Name Type Description
xpath string xpath to the element.

GetAddressOfRemoteServer

AppiumDriver.GetAddressOfRemoteServer()

Returns:

URL of the remote Appium server.

GetContext

AppiumDriver.GetContext()

Returns:

Current context (NATIVE_APP or WEBVIEW_*).

GetContexts

AppiumDriver.GetContexts()

Returns:

Array of available contexts for a hybrid application.

GetCurrentActivity

AppiumDriver.GetCurrentActivity()

GetCurrentWindowHandle

Gets the current window handle, which is an opaque handle to this window that uniquely identifies it within this driver instance.

AppiumDriver.GetCurrentWindowHandle()

GetIMEActiveEngine

AppiumDriver.GetIMEActiveEngine()

Returns:

Currently active IME Engine on the device.

GetIMEAvailableEngines

AppiumDriver.GetIMEAvailableEngines()

Returns:

A list of IME engines available on the device.

GetOrientation

AppiumDriver.GetOrientation()

Returns:

Orientation of the device (0 - portrait, 1 - landscape).

GetPageSource

Gets the source of the page last loaded by the browser.

AppiumDriver.GetPageSource()

GetSessionId

AppiumDriver.GetSessionId()

Returns:

Id of the current session.

GetTitle

Gets the title of the current browser window.

AppiumDriver.GetTitle()

GetUrl

Gets the URL the browser is currently displaying.

AppiumDriver.GetUrl()

GetWindowHandles

Gets the window handles of open browser windows.

AppiumDriver.GetWindowHandles()

HideKeyboard

Hide soft keyboard

AppiumDriver.HideKeyboard(strategy, key)

Parameters:

Name Type Description
strategy string Hide keyboard strategy (optional, UIAutomation only). Available strategies - 'press', 'pressKey', 'swipeDown', 'tapOut', 'tapOutside', 'default'.
key string Key
Optional.

IgnoreUnimportantViews

This capability can speed up test execution, since Accessibility commands will run faster ignoring some elements. The ignored elements will not be findable.

AppiumDriver.IgnoreUnimportantViews(value)

Parameters:

Name Type Description
value bool true to ignore.

InstallApp

Install the given app onto the device.

AppiumDriver.InstallApp(appPath)

Parameters:

Name Type Description
appPath string Path of the app being installed

IsAppInstalled

Check whether the specified app is installed on the device.

AppiumDriver.IsAppInstalled(bundleId)

Parameters:

Name Type Description
bundleId string iOS bundleID or Android package name

IsIMEActive

Check if IME is active.

AppiumDriver.IsIMEActive()

IsLocked

Check whether the device is locked or not

AppiumDriver.IsLocked()

LaunchApp

Launch the app-under-test on the device

AppiumDriver.LaunchApp()

OpenNotifications

Open Android notifications (Emulator only)

AppiumDriver.OpenNotifications()

PerformActions

Performs W3C actions. Requires Rapise 8.2+. See CreatePointerInput for usage example.

AppiumDriver.PerformActions(sequence)

Parameters:

Name Type Description
sequence ActionSequence Array of ActionSequence objects.

PressKeyCode

Press a particular key on Device

AppiumDriver.PressKeyCode(keyCode)

Parameters:

Name Type Description
keyCode number Key code pressed on the device.

PullFile

Retrieve a file from the device's file system.

AppiumDriver.PullFile(pathOnDevice)

Parameters:

Name Type Description
pathOnDevice string Path on the device to pull file from

PushFile

Place a file onto the device in a particular place.

AppiumDriver.PushFile(pathOnDevice, base64Data)

Parameters:

Name Type Description
pathOnDevice string Path to install the data to.
base64Data string Contents of file in base64.

Quit

Disconnects from the Browser.

AppiumDriver.Quit()

ReconnectSession

Reads session information produced by SaveSession and connects to the mobile target.

AppiumDriver.ReconnectSession(autoCreate)

Parameters:

Name Type Description
autoCreate boolean 'true' to automatically create a new session if there is no saved session or saved session is not available anymore.
Optional, Default: "false".

RemoveApp

Remove an app from the device

AppiumDriver.RemoveApp(appId)

Parameters:

Name Type Description
appId string The iOS App ID

ResetApp

Reset the currently running app for this session

AppiumDriver.ResetApp()

SaveSession

Saves session information for use by ReconnectSession.

AppiumDriver.SaveSession()

SeSFind

Finds an element given it's locator string. Requires Rapise 8.1+.

AppiumDriver.SeSFind(selector, objectType, selectorType, objectName)

Parameters:

Name Type Description
selector string Selector query, format depends on a selector type.
objectType string Type of an object: android, ios or web. Possible values: "android", "ios", "web"
Optional, Default: "web".
selectorType string Type of a selector: acc, css, id, ios, xpath. Possible values: "acc", "css", "id", "ios", "xpath"
Optional, Default: "xpath".
objectName string Name to assign to the found object. Used in the report.
Optional.

SetContext

Sets current context.

AppiumDriver.SetContext(name)

Parameters:

Name Type Description
name string The name of the context to which to change

SetOrientation

Sets device orienataion.

AppiumDriver.SetOrientation(orientation)

Parameters:

Name Type Description
orientation number 0 - portrait, 1 - landscape

SetUrl

Sets the URL the browser is currently displaying.

AppiumDriver.SetUrl(value)

Parameters:

Name Type Description
value string The URL to display

ShakeDevice

Perform a shake action on the device

AppiumDriver.ShakeDevice()

StartActivity

Start an Android activity by providing package name and activity name

AppiumDriver.StartActivity(appPackage, appActivity, appWaitPackage, appWaitActivity)

Parameters:

Name Type Description
appPackage string Name of the package
appActivity string Name of the activity
appWaitPackage string Automation will begin after this package starts
appWaitActivity string appWaitActivity

StartRecordingScreen

Starts video recording on a device. Requires Rapise 8.0+.

AppiumDriver.StartRecordingScreen()

Returns:

'true' if successful, 'false' otherwise.

StopRecordingScreen

Stops video recording on a device. Requires Rapise 8.0+.

AppiumDriver.StopRecordingScreen()

Returns:

'true' if successful, 'false' otherwise.

ToggleAirplaneMode

Toggle airplane mode on device

AppiumDriver.ToggleAirplaneMode()

ToggleLocationServices

Switch the state of the location service

AppiumDriver.ToggleLocationServices()

ToggleWifi

Switch the state of the WiFi service

AppiumDriver.ToggleWifi()