Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

CommandDescriptionExampleSeeTest Docs
void dragDropAllows you to drag an element or text from a specified zone and drop it into another element.
Code Block
languagejava
themeEclipse
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.
Code Block
languagejava
themeEclipse
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.
Code Block
languagejava
themeEclipse
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)
Code Block
languagejava
themeEclipse
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.
Code Block
languagejava
themeEclipse
titleTo open Wifi screen on the device:
driver.executeScript(seetest:client.run(\"adb shell am start -a android.settings.WIFI_SETTING\")");
Code Block
languagejava
themeEclipse
titleFor pressing Volume key up:
driver.executeScript(seetest:client.run(\"adb shell input keyevent 'KEYCODE_VOLUME_UP'\")");
Code Block
languagejava
themeEclipse
titleFor pressing Volume key down:
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.
Code Block
languagejava
themeEclipse
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.
Code Block
languagejava
themeEclipse
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.
Code Block
languagejava
themeEclipse
driver.executeScript("seetest:client.elementSendText(\"NATIVE\", \"id=search_src_text\", \"0\", \"shoes\")");
SeeTestAutomation elementSendText
StringelementSetPropertyString elementSetProperty(String zone, String element, int index, String property, String value)Design commands to set values of controllers such as date pickers, sliders, switches etc..
Code Block
languagejava
themeEclipse
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.
Code Block
languagejava
themeEclipse
driver.executeScript("seetest:client.setDevice(\"adb:Nexus5\")");
SeeTestAutomation setDevice
void clearDeviceLog()Clears the log file of the connected device.
Code Block
languagejava
themeEclipse
driver.executeScript("seetest:client.clearDeviceLog()");
SeeTestAutomation clearDeviceLog
void closeKeyboard()Closes the soft-keypad if it's open in the device
Code Block
languagejava
themeEclipse
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.
Code Block
languagejava
themeEclipse
driver.executeScript("seetest:client.pinch(\"true\", \"600\", \"1000\", \"700\", \"false\")");
SeeTestAutmation pinch
voidreleaseDevicevoid releaseDevice(String deviceName, booleanreleaseAgentboolean releaseAgent, 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
Code Block
languagejava
themeEclipse
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.
Code Block
languagejava
themeEclipse
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).
Code Block
languagejava
themeEclipse
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.
Code Block
languagejava
themeEclipse
driver.executeScript("seetest:client.swipe(\"Up\", 0, 500)");
SeeTestAutomation swipe
void flick(String direction, int offset)Flicks the screen in a given direction.
Code Block
languagejava
themeEclipse
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).
Code Block
languagejava
themeEclipse
driver.executeScript("seetest:client.dragCoordinates(\"636\", \"826\", \"572\", \"1166\", \"2000\")");
SeeTestAutomation dragCoordinates
boolean reboot(int timeout)Commands the device to reboot.
Code Block
languagejava
themeEclipse
driver.executeScript("seetest:client.reboot(\"120000\")");
SeeTestAutomation reboot
void setDefaultClickDownTime(int downTime)Sets the default click down time (default is 100 miliseconds).
Code Block
languagejava
themeEclipse
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).
Code Block
languagejava
themeEclipse
driver.executeScript("seetest:client.clickCoordinate(\"991\", \"460\", \"1\")");
SeeTestAutomation clickCoordinate
String getDeviceProperty(String key)

This command will retrieve the following device properties:

Code Block
languagejava
themeEclipse
driver.executeScript("seetest:client.getDeviceProperty(\"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.
Code Block
languagejava
themeEclipse
String property = (String)driver.executeScript("seetest:client.elementGetProperty(\"NATIVE\", \"xpath=//*[]UIDatePicker\", \"0\", \"date\")");
SeeTestAutomation elementGetProperty
String getVisualDump(String type)Returns a String which contains the XML with all the dump (object spy) properties of the screen.
Code Block
languagejava
themeEclipse
String visualDump = (String)driver.executeScript("seetest:client.getVisualDump(\"Native\")");
SeeTestAutomation getVisualDump

voiddeviceActionvoid deviceAction(String action)

Executes the chosen action on the device. Used to simulate physical actions on the device.


Code Block
languagejava
themeEclipse
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.
Code Block
languagejava
themeEclipse
driver.executeScript("seetest:client.setProperty(\"screen.quality\", \"50\")");
SeeTestAutomation setProperty
boolean getNetworkConnection(String connection)Retrieves the network connection of a device.
Code Block
languagejava
themeEclipse
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.
Code Block
languagejava
themeEclipse
driver.executeScript("seetest:client.setLocation(\"36.296238\", \"-91.933594\")"); // USA
SeeTestAutomation setLocation
String setDefaultTimeout(int newTimeout)Sets the default timeout for click commands.
Code Block
languagejava
themeEclipse
driver.executeScript("seetest:client.setDefaultTimeout(\"1000\")");
SeeTestAutomation setDefaultTimeout
void setSpeed(String speed)

Sets the speed of the test.

Parameters:

  • Slow
  • Normal
  • Fast
Code Block
languagejava
themeEclipse
driver.executeScript("seetest:client.setSpeed(\"Fast\")");
SeeTestAutomation setSpeed

boolean swipeWhileNotFound(String direction, int offset, int swipeTime, String zone, StringelementtofindString elementtofind, intelementtofindindexint elementtofindindex, int delay, int rounds, boolean click) {



Swipe the screen to search for an element.
Code Block
driver.executeScript("seetest:client.swipeWhileNotFound(\"LEFT\", 200, 2000, 'NATIVE', \"xpath=//*[@Text='submit']\", 0, 1000, 5, true)");



SeeTestAutomation swipeWhileNotFound
voidsetNetworkConnectionvoid setNetworkConnection(String connection, boolean enable)

Gives the ability to set the network connection for a device.

Parameters:

  • airplane_mode
  • wifi
  • mobile_data
Code Block
languagejava
themeEclipse
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.
Code Block
languagejava
themeEclipse
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.
Code Block
languagejava
themeEclipse
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 viewswebviews.
Code Block
languagejava
themeEclipse
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

Code Block
languagejava
themeEclipse
driver.executeScript("seetest:client.simulateCapture(\"C:/images/image.jpg\")");
SeeTestAutomation simulateCapture

void startCaptureNetworkDump(StringlocalFilePathString localFilePath)

void stopCaptureNetworkDump()

Supports capturing device network traffic to PCAP file

Supported only with the SeeTest - Appium Extension

Code Block
languagejava
themeEclipse
driver.executeScript("seetest:client.startCaptureNetworkDump(\"C:\\tmp\\device.pcap\")");
Code Block
languagejava
themeEclipse
driver.executeScript("seetest:client.stopCaptureNetworkDump()");
SeeTestAutomation CaptureNetworkDump

...

CommandDescriptionExampleSeeTest Docs
boolean install(String path, boolean instrument, boolean keepData)Installs the application on the tested device during runtime.
Code Block
languagejava
themeEclipse
driver.executeScript("seetest:client.install(\"com.experitest.ExperiBank/.LoginActivity\", \"true\", \"true\")");
SeeTestAutomation install
boolean uninstall(String application)Uninstalls the application from the device.
Code Block
languagejava
themeEclipse
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.
Code Block
languagejava
themeEclipse
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.
Code Block
languagejava
themeEclipse
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.
Code Block
languagejava
themeEclipse
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.
Code Block
languagejava
themeEclipse
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
Code Block
languagejava
themeEclipse
String applicationName = (String)driver.executeScript("seetest:client.getCurrentApplicationName()");
SeeTestAutomation getCurrentApplicationName


Monitor CPU

...

\ Memory

...

\ Network


CommandDescriptionExampleSeeTest Docs
void startMonitor(String pacakgeName)Starts monitors CPU/Memory consumption per Application
Code Block
languagejava
themeEclipse
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.
Code Block
languagejava
themeEclipse
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.
Code Block
languagejava
themeEclipse
driver.executeScript("seetest:client.getMonitorsData('monitors.csv')");
// stores the monitors captured so far in a CSV file			
GetMonitorsData

...