Additional Commands
Please note that this tool is classified as a Legacy tool. We recommend transitioning to our updated solutions to maintain optimal performance and security in your workflows. For more information on this matter, please reach out to technical support .
Appium Studio features additional commands (originally SeeTestAutomation commands) that extend Appium by providing testers functionality otherwise unavailable (in Appium Server). These commands allow the tester to create more elaborate tests with expanded contexts such as device properties, application control and interaction, and reporting capabilities.
Testers can make use of these commands by providing them as parameters in Appium's driver.executeScript() method.
For example, if you wanted to get any device property (iOS version, serial number, model, etc.) you could make use of the SeeTestAutomation command: client.getDeviceProperty
Example - Execute Script for additional capabilities
driver.executeScript("seetest:client.getDeviceProperty('device.SN')") //to get the device's serial number.
The return from the command is a JSON style map which can be parsed in the client-side Example - Parse JSON result
final String result = driver.executeScript("seetest:client.getDeviceProperty('device.SN');").toString();
JSONObject jsonResult = new JSONObject(result);
jsonResult.keySet().stream().forEach(key -> {
System.out.println("Key : " + key + " Val : " + jsonResult.get(key));
});
String serialNumber = jsonResult.get("text");
Device Control
The full list of KeyCodes
Command | Description | Example | SeeTest Docs |
---|---|---|---|
void dragDrop | Allows you to drag an element or text from a specified zone and drop it into another element. | driver.executeScript("seetest:client.dragDrop(\"NATIVE\", \"xpath=//*[@text='Play Store']\", \"0\", \"xpath=//*[@text='Google Folder']\", \"0\")"); | SeeTestAutomation dragDrop |
void drag(String zone, String element, int index, int xOffset, int yOffset) | Allows you to drag an element or text to a specified zone. | driver.executeScript("seetest:client.drag(\"NATIVE\", \"xpath=//*[@text='Play Store']\", \"0\", \"0\", \"-300\")"); | SeeTestAutomation drag |
void setDragStartDelay(int delay) | Defines how long before the drag action takes place. | driver.executeScript("seetest:client.setDragStartDelay(1000)"); | SeeTestAutomation setDragStartDelay |
void elementListSelect(String listLocator, String elementLocator, int index, boolean click) | Selects an element within a list (first making the element visible) | driver.executeScript("seetest:client.elementListSelect(\"accessibilityLabel=conutryView\",\"text=Brazil\", \"0\", \"true\")"); | SeeTestAutomation elementListSelect |
String run(String Command) | Run ADB commands or other device shell commands. | To open the WiFi settings screen:driver.executeScript(seetest:client.run(\"adb shell am start -a android.settings.WIFI_SETTING\")"); To press the up volume key: driver.executeScript(seetest:client.run(\"adb shell input keyevent 'KEYCODE_VOLUME_UP'\")"); To press the down volume key: driver.executeScript("seetest:client.run(\"adb shell input keyevent 'KEYCODE_VOLUME_DOWN'\")"); | SeeTestAutomation run The full list of key codes |
String runNativeAPICall(String zone, String element, int index, String script) | Gives you the ability to create and run scripts that are based on the Native API methods available for the class of the element. | driver.executeScript("seetest:client.runNativeAPICall(\"NATIVE\", \"xpath=//*[@id='video_view']\", 0, \"view.pause(); var length = view.getDuration(); length = length*0.9; view.seekTo(length);\");"); | SeeTestAutomation runNativeApiCall |
String elementGetText(String zone, String element, int index) | Gets text from elements - The text will be saved as a string. | String str = (String)driver.executeScript("seetest:client.elementGetText(\"NATIVE\", \"xpath=//*[@id='countryTextField']\", \"0\")"); | SeeTestAutomation elementGetText |
void elementSendText(String zone, String element, int index, String text) | Sends text to an element. | driver.executeScript("seetest:client.elementSendText(\"NATIVE\", \"id=search_src_text\", \"0\", \"shoes\")"); | SeeTestAutomation elementSendText |
StringelementSetProperty(String zone, String element, int index, String property, String value) | Design commands to set values of controllers such as date pickers, sliders, switches, etc. | driver.executeScript("seetest:client.elementSetProperty(\"NATIVE\", \"xpath=//*[@class='UIDatePicker' and @hidden='false']\", \"0\", \"date\", \"true\")"); | SeeTestAutomation elementSetProperty |
void setDevice(String device) | Set the active device under test. | driver.executeScript("seetest:client.setDevice(\"adb:Nexus5\")"); | SeeTestAutomation setDevice |
void clearDeviceLog() | Clears the log file of the connected device. | driver.executeScript("seetest:client.clearDeviceLog()"); | SeeTestAutomation clearDeviceLog |
void closeKeyboard() | Closes the soft-keypad if it's open in the device | driver.executeScript("seetest:client.closeKeyboard()"); | SeeTestAutomation closeKeyboard |
boolean pinch(boolean inside, int x, int y, int radius, boolean horizontal) | Pinch In/Out at a specific location using a specific pinch radius. | driver.executeScript("seetest:client.pinch(\"true\", \"600\", \"1000\", \"700\", \"false\")"); | SeeTestAutmation pinch |
voidreleaseDevice(String deviceName, booleanreleaseAgent, boolean removeFromDeviceList, boolean releaseFromCloud) | This command allows the user to release the device at the end of a test and also specify other related parameters such as releasing from the cloud and removing the device from the device list | driver.executeScript("seetest:client.releaseDevice(\"adb:Galaxy Tab\", \"true\", \"true\", \"true\")"); | SeeTestAutomation releaseDevice |
String getDevicesInformation() | Returns a string in XML format containing all the device's information. | String deviceInformation = (String)driver.executeScript("seetest:client.getDevicesInformation()"); | SeeTestAutomation getDeviceInformation |
String getConnectedDevices() | Returns a string of all devices currently available in the device list (on ready mode). | String connectedDevices = (String)driver.executeScript("seetest:client.getConnectedDevices()"); | SeeTestAutomation getConnectedDevices |
void swipe(String direction, int offset, int time) | Swipes the screen in a given direction, from a given offset, and for a given duration. | driver.executeScript("seetest:client.swipe(\"Up\", 0, 500)"); | SeeTestAutomation swipe |
void flick(String direction, int offset) | Flicks the screen in a given direction. | driver.executeScript("seetest:client.flick(\"Right\", \"100\")"); | SeeTestAutomation flick |
void dragCoordinates(int x1, int y1, int x2, int y2, int time) | Performs a drag action based on start coordinates (X,Y) and end coordinates (X,Y). | driver.executeScript("seetest:client.dragCoordinates(\"636\", \"826\", \"572\", \"1166\", \"2000\")"); | SeeTestAutomation dragCoordinates |
boolean reboot(int timeout) | Commands the device to reboot. | driver.executeScript("seetest:client.reboot(\"120000\")"); | SeeTestAutomation reboot |
void setDefaultClickDownTime(int downTime) | Sets the default click down time (default is 100 miliseconds). | driver.executeScript("seetest:client.setDefaultClickDownTime(\"1000\")"); | SeeTestAutomation setDefaultClickDownTime |
void clickCoordinate(int x, int y, int clickCount) | Performs a click on a specified zone according to coordinates (X, Y). | driver.executeScript("seetest:client.clickCoordinate(\"991\", \"460\", \"1\")"); | SeeTestAutomation clickCoordinate |
String getDeviceProperty(String key) | This command will retrieve the following device properties: | driver.executeScript("seetest:client.getDeviceProperty(\"[device.name](http://device.name)\")"); | SeeTestAutomation getDeviceProperty |
String elementGetProperty(String zone, String element, int index, String property) | Gets a property of an element. Can retrieve all properties of the elements that are showing on the object spy as also controllers. | String property = (String)driver.executeScript("seetest:client.elementGetProperty(\"NATIVE\", \"xpath=//*[]UIDatePicker\", \"0\", \"date\")"); | SeeTestAutomation elementGetProperty |
String getVisualDump(String type) | Returns a String that contains the XML with all the dump (object spy) properties of the screen. | String visualDump = (String)driver.executeScript("seetest:client.getVisualDump(\"Native\")"); | SeeTestAutomation getVisualDump |
voiddeviceAction(String action) | Executes the chosen action on the device. Used to simulate physical actions on the device. | driver.executeScript("seetest:client.deviceAction(\"Home\")"); | SeeTestAutomation deviceAction |
void setProperty(String key, String value) | This command can change the configuration on the device during runtime. | driver.executeScript("seetest:client.setProperty(\"screen.quality\", \"50\")"); | SeeTestAutomation setProperty |
boolean getNetworkConnection(String connection) | Retrieves the network connection of a device. | if(driver.executeScript("seetest:client.getNetworkConnection(\"airplane_mode\")")){ //if statement } | SeeTestAutomation getNetworkConnection |
void setLocation(String latitude, String longitude) | Tests geolocation-based applications by allowing the user to set the location of the device as necessary for testing. It is assumed that the user has pre-configured the device for location testing. | driver.executeScript("seetest:client.setLocation(\"36.296238\", \"-91.933594\")"); // USA | SeeTestAutomation setLocation |
String setDefaultTimeout(int newTimeout) | Sets the default timeout for click commands. | driver.executeScript("seetest:client.setDefaultTimeout(\"1000\")"); | SeeTestAutomation setDefaultTimeout |
void setSpeed(String speed) | Sets the speed of the test. Parameters: * Slow * Normal * Fast | driver.executeScript("seetest:client.setSpeed(\"Fast\")"); | SeeTestAutomation setSpeed |
boolean swipeWhileNotFound(String direction, int offset, int swipeTime, String zone, Stringelementtofind, intelementtofindindex, int delay, int rounds, boolean click) | Swipe the screen to search for an element. | driver.executeScript("seetest:client.swipeWhileNotFound(\"LEFT\", 200, 2000, 'NATIVE', \"xpath=//*[@Text='submit']\", 0, 1000, 5, true)"); | SeeTestAutomation swipeWhileNotFound |
voidsetNetworkConnection(String connection, boolean enable) | Gives the ability to set the network connection for a device. Parameters: * airplane_mode * wifi * mobile_data | driver.executeScript("seetest:client.setNetworkConnection(\"airplane_mode\", \"true\")"); | SeeTestAutomation setNetworkConnection |
void touchDown(String zone, String element, int index) void touchMove(String zone, String element, int index) void touchUp() | Performs various touch actions. | driver.executeScript("seetest:client.touchDown(\"NATIVE\", \"xpath=//*[@accessibilityLabel='Username']\", \"0\")"); driver.executeScript("seetest:client.touchMove(\"NATIVE\", \"xpath=//*[@text='Login']\", \"0\")"); driver.executeScript("seetest:client.touchUp()"); | SeeTestAutomation Touch Commands |
String[] getAllValues(String zone, String element, String property) | Returns an array with all of the value per attribute (e.g text) from elements represented by an XPath expression. | String [] strArray = driver.executeScript("seetest:client.getAllValues(\"NATIVE\", \"xpath=//*[@id='countryList']/..//*[@id='rowTextView']\", \"text\")"); | SeeTestAutomation getAllValues |
String[] getContextList() | Returns a list of current contexts including all web views. | String contexts = (String)driver.executeScript("seetest:client.getContextList()"); | SeeTestAutomation getContextList |
void simulateCapture(String picturePath) | Allows users to test applications that use the camera on a mobile device by injecting an image file to the camera preview screen. | Supported only with the SeeTest - Appium Extension | SeeTestAutomation simulateCapture |
void startCaptureNetworkDump(StringlocalFilePath) void stopCaptureNetworkDump() | Supports capturing device network traffic to PCAP file | Supported only with the SeeTest - Appium Extension | SeeTestAutomation CaptureNetworkDump |
void setAuthenticationReply | Simulates different authentication responses on applications that request a user fingerprint authentication. | driver.executeScript("seetest:client.setAuthenticationReply(\"Success\",10000)"); | SetAuthenticationReply |
Element Commands
Command | Description | Example | SeeTest Docs |
---|---|---|---|
void verifyElementFound(String zoneName, String elementName, int index) | Verifies if the element is located on the screen. | driver.executeScript("seetest:client.verifyElementFound(\"NATIVE\", "//*[@text=\"Login\"],0)"); | [VerifyElementFound](#) |
boolean syncElements(int silentTime, int timeout) * silentTime - The period of time for the UI elements to be static in milliseconds. * timeout - Waiting for a timeout in milliseconds return true if operation finished successfully | Synchronize UI elements Wait for all the UI elements on the page to appear. Works on the dump level - checks for changes in the UI dump. | driver.executeScript("seetest:client.syncElements(3000, 10000)"); |
Application Preparation
Command | Description | Example | SeeTest Docs |
---|---|---|---|
boolean install(String path, boolean instrument, boolean keepData) | Installs the application on the tested device during runtime. | driver.executeScript("seetest:client.install(\"com.experitest.ExperiBank/.LoginActivity\", \"true\", \"true\")"); | SeeTestAutomation install |
boolean uninstall(String application) | Uninstalls the application from the device. | driver.executeScript("seetest:uninstall(\"com.experitest.ExperiBank\")"); | SeeTestAutomation uninstall |
boolean applicationClose(String packageName) | This command will close and kill the application on the foreground of the device during runtime. | driver.executeScript("seetest:client.applicationClose(\"com.experitest.ExperiBank/.LoginActivity\")"); | SeeTestAutomation applicationClose |
void applicationClearData(String packageName) | This command will clear the entire application data and cache from the device it is installed on during runtime. | driver.executeScript("seetest:client.applicationClearData(\"com.experitest.ExperiBank/.LoginActivity\")"); | SeeTestAutomation applicationClearData |
void launch(String activityURL, boolean instrument, boolean stopIfRunning) | Launches activity (application) or navigates to a given URL during runtime. | driver.executeScript("seetest:client.launch(\"com.experitest.ExperiBank/.LoginActivity\", \"true\", \"true\")"); | SeeTestAutomation launch |
String getInstalledApplications() | Returns a list of applications that are installed on the device. | String applications = (String)driver.executeScript("seetest:client.getInstalledApplications()"); | SeeTestAutomation getInstalledApplications |
String getCurrentApplicationName() | Retrieves the name/bundle/package name of the application that's currently run in the foreground of the active device | String applicationName = (String)driver.executeScript("seetest:client.getCurrentApplicationName()"); | [SeeTestAutomation getCurrentApplicationName](#) |
Monitor CPU/Memory/Network
Command | Description | Example | SeeTest Docs |
---|---|---|---|
void startMonitor(String pacakgeName) | Starts monitors CPU/Memory consumption per Application | driver.executeScript("seetest:client.startMonitor('cpu:com.experitest.ExperiBank')"); // starts monitor CPU for EriBank app | StartMonitor |
void setMonitorPollingInterval (Int TimeInMille) | Sets the polling time interval for monitoring command. | driver.executeScript("seetest:client.setMonitorPollingTimeInteval(2000)"); // sets the int eval for 1 second | SetMonitorPollingInterval |
String getMonitorsData(String filePath) | Stores the monitoring data captured so far in a CSV file. | driver.executeScript("seetest:client.getMonitorsData('monitors.csv')"); // stores the monitors captured so far in a CSV file | GetMonitorsData |
Report and Utilities
Command | Description | Example | SeeTest Docs |
---|---|---|---|
void report(String message, boolean status) void report(String pathToImage, String message, boolean status) | Enhances the reports generated after test runs. A standard report contains a line for each execution step. This command allows for the customizing of the report by presenting meaningful information for a specific step (or a set of steps). This information can consist of a custom remark and/or an image. Adding an image to the report could be done with a URL to the image or a path to a file that is reachable by the remote machine. Only .png images are supported. | driver.executeScript("seetest:client.report(\"This is a custom message inserted into the test report. It will be marked there as failed\", \"false\")"); driver.executeScript("seetest:client.report(\"http://example.com\image\", \"This is a custom message inserted into the test report. It will be marked there as a success\", \"true\")"); | SeeTestAutomation report |
void startStepsGroup(String caption) | StartStepsGroup begins group marks (and StopStepsGroup ends it). All the steps that appear between those two steps will appear under the same group on the report. | driver.executeScript("seetest:client.startStepsGroup(\"Steps Group1\")"); | SeeTestAutomation startStepsGroup |
void stopStepsGroup() | This command compliments the StartStepsGroup command. Using this command will mark the end of the group of the current steps | driver.executeScript("seetest:client.stopStepsGroup()"); | SeeTestAutomation stopStepsGroup |
String getDeviceLog() | *For iOS devices only* Downloads the device log to the directory where the report is located. | String log = (String)driver.executeScript("seetest:client.getDeviceLog()"); | SeeTestAutomation getDeviceLog |
void setShowReport(boolean showReport) | Configures the generated report. Determine if to show steps in the report or not. By default, the command is set to SetShowReport(True). | driver.executeScript("seetest:client.setShowReport(false)"); | SeeTestAutomation SetShowReport |
void setShowPassImageInReport(boolean showPassImageInReport) | Using this command, you can configure the generated HTML report. Based on the command, steps on the report will either have the screenshot of the device or not during the command execution. | driver.executeScript("seetest:client.setShowImageInReport(false)"); | SeeTestAutomation setShowPassImageInReport |
String collectSupportData(String zipDestination, String applicationPath, String device, String scenario, String expectedResult, String actualResult) String collectSupportData(String zipDestination, String applicationPath, String device, String scenario, String expectedResult, String actualResult, boolean withCloudData, boolean onlyLatestLogs) | Collects the support data (consists of error.log, device.log, SeeTestAutomation.log etc) during run time. | driver.executeScript("seetest:client.collectSupportData(\"C:\supportData.zip\", <Installation_folder_path>\bin\ipas\eribank.apk,\"adb:GT-I9300\",\"click error\", \"expected click to work\", \"click has failed\")"); | SeeTestAutomation collectSupportData |
void setTestStatus(boolean status, String message) | Set the test as passed or failed | driver.executeScript("seetest:client.setTestStatus(\"false\",\"test-failed\")"); | SeeTestAutomation setTestStatus |
void setReportStatus(String status, String message, String stackTrace) | Set the test status as Passed, Failed, or Skipped | driver.executeScript("seetest:client.setReportStatus(\"Skipped\",\"test is skipped\",\"a stacktrace\")"); | SeeTestAutomation setReportStatus |
void setReportStatus(String status, String message) | Set the test status as Passed, Failed or Skipped | driver.executeScript("seetest:client.setReportStatus(\"FAILED\",\"test failed\")"); | SeeTestAutomation setReportStatus |
boolean addTestProperty(String property, String value) | Add property to test report | driver.executeScript("seetest:client.addTestProperty(\"proopertyName\",\"property value\")"); | SeeTestAutomation- addTestProperty |
void hybridClearCache() | Clears the browser's cache. | driver.executeScript("seetest:client.hybridClearCache()"); | SeeTestAutomation- HybridClearCache |
Server Configuration
Command | Description | Example | SeeTest Docs |
---|---|---|---|
void setNetworkConditions(String profile, int duration) | Selects the profile configured on the Network Virtualization server to test the device under the different network conditions. | driver.executeScript("seetest:client.setNetworkConditions(\"LowLatency\", \"30000\")"); | SeeTestAutomation setNetworkConditions |
Mobile Gestures for iOS Commands
Appium Documentation: Automating Mobile Gestures For iOS With WebDriverAgent/XCTest Backend
We are currently not supporting containers options for mobile: scroll command