GDSL commands for Android
update 25 nov 2024
Command catalog
Here is the description of the DSL commands grouped by domain.
Application
Assert
Browser Manager
Click
Device
Dump
File Manager
Find
Form
Network
Keyboard
OTP
Probe
Screen
Screenshots
Settings
Set text
Scroll
UIAutomatorViewer Configuration
Wait objects
Zoom
Details of the commands and their use cases can be found in the section Methods details
A parameter for a command should not contain any comma as it is the separator character.
Application
Command | Example | Description |
---|---|---|
applicationStart |
| Starts an application from its package name. compatibility : universal |
applicationToForeground |
| Sets an already launched application to foreground from its package name. compatibility : universal |
applicationKill |
| Forces an application to stop from its package name. compatibility : universal |
applicationClearData |
| Clears the cache of an application from its package name. compatibility : universal |
installApp |
| Installs the application from its package name. |
uninstallApp |
| Uninstalls the application from its package name. compatibility : universal |
applicationCloseAll | Â | Clears every recent application. |
Assert
Command | Example | Description |
---|---|---|
assertNotExistsText |
| Checks if the element which text or content-desc contains the text selector doesn't exist. case-sensitive compatibility : universal |
assertNotExistsTextExact |
| Checks if the element which text or content-desc is the exact given selector doesn't exist. CASE-SENSITIVE compatibility : universal |
assertNotExistsId |
| Checks if the element with the id selector doesn't exist. compatibility : universal |
assertNotExistsClass |
| Checks if the element with the class selector doesn't exist. compatibility : universal |
Browser Manager
Command | Example | Description |
---|---|---|
setBrowser |
| Sets the browser to use. |
launchBrowser | Â | Launches the current set browser. If not set, launches default browser Chrome. |
browserClearCache | Â | Clears the cache of the current set browser. |
browserNewTab | Â | Opens a new tab on the current set browser. |
browserGoToUrl |
| Browses the given url on the current set browser. |
browserCloseAllTabs | Â | Closes every opened tabs on the current set browser. |
browserReset | Â | Browser reset clear cache and user data and prepare the browser for the test. |
waitUntilPageLoaded |
| Waits until the current web page is loaded. compatibility : universal |
browserPrepareAndOpen | Â | Prepares browser for measurement: (clear cache, close all tabs, close browser and reopen it) |
browserCloseAllTabsAndOpen | Â | Closes all browser tabs and open a new tab. (Browser will be closed during process) |
browserPrepareAndOpenForReference | Â | Prepares browser for measurement. Clear cache, close all tabs, close browser and reopen it, go to a black page and wait 60s. |
changeDefaultSearchEngine |
| Changes browser default search engine (Not supported on Firefox) Â |
enableDisplaySiteAsDesktop | Â | Enables display site as desktop. The browser and website need to be already opened. |
disableDisplaySiteAsDesktop | Â | Disables display site as desktop. The browser and website need to be already opened. |
Click
Command | Example | Description |
---|---|---|
longClickById |
| Performs a long click for the given duration on the element which contains the given id selector. default : 1000 optional duration compatibility : universal |
longClickByText |
| Performs a long click for the given duration on the element which contains the given text selector. default : 1000 optional duration compatibility : universal |
longClickByXY |
| Performs a long click of the given duration on the given coordinate. default : 1000 compatibility : universal |
clickByText |
| Clicks on the element which contains the given text selector. CASE-SENSITIVE compatibility : universal |
clickByTextExact |
| Clicks on the element which contains the exact given text selector. CASE-SENSITIVE compatibility : universal |
clickByClass |
| Clicks on the element with the given class selector. compatibility : universal |
clickByXY |
| Clicks on the element located at the given coordinates. compatibility : universal |
clickByPercent |
| Clicks on the element located at the coordinates calculated from the given percentages of the device screen. compatibility : universal |
clickById |
| Clicks on the element which contains the given identification. compatibility : universal |
clickOnLastElementFound | Â | Clicks on the last element found by previous GDSL command in group Find like compatibility : universal |
clickByTextForced |
| Clicks on the element which contains the given text if exists compatibility : universal |
Device
Command | Example | Description |
---|---|---|
pressHome | Â | Presses the home button. compatibility : universal |
pause |
| Waits the amount of time in millisecond passed as argument. compatibility : universal |
pressEnter | Â | Presses the enter button. compatibility : universal |
pressPower | Â | Presses the power button. compatibility : universal |
pressBack | Â | Presses the back button. compatibility : universal |
pressRecentApps | Â | Presses the recent app button. compatibility : universal |
pressTab | Â | Presses the TAB key. You can navigate to the next element in the view that can get focus. Useful for form. compatibility : universal |
pressMajTab | Â | Presses the MAJ + TAB key. You can navigate to the previous element in the view that can get focus. Useful for form. compatibility : universal |
setVolume |
| Sets the volume of every stream of the device to the given value. |
pressKeyCode |
| Realize an action using a key code. Can use optional meta State when pressing. List of keycode and meta state are here : https://developer.android.com/reference/android/view/KeyEvent. compatibility : universal |
openQuickSettings | Â | Opens the quick settings. compatibility : universal |
enableHotspot | Â | Enables the hotspot setting. |
disableHotspot | Â | Disables the hotspot setting. |
enableSettings |
| Enables the first setting in the given setting name list. |
disableSettings |
| Disables the first setting in the given setting name list. |
Dump
Command | Example | Description |
---|---|---|
dump |
| Takes a dump of the current state of the device. If set the dump will be stored in optional parameter compatibility : universal |
File Manager
Command | Example | Description |
---|---|---|
filesEmptyDownloadsFolder | Â | Empties the download folder of the device |
filesOpenDownloadsFolder | Â | Opens the file system and go to the download folder. |
filesSelectDownloadsFolder | Â | On a opened file system, goes to the download folder |
filesDownloadFile |
| Download a file. The file will be stored in the device's Downloadd file. |
Find
Command | Example | Description |
---|---|---|
findByText |
| Finds the nth element which text or content-desc contains the given selector. The element is saved as the last element found. CASE-SENSITIVE default rank : 1 optional rank compatibility : universal |
findByTextExact |
| Finds the nth element which text or content-desc is the exact given selector. The element is saved as the last element found. CASE-SENSITIVE default rank : 1 optional rank compatibility : universal |
findById |
| Finds the nth element with the id selector. The element is saved as the last element found. default rank : 1 optional rank compatibility : universal |
findByClass |
| Finds the nth element with the class selector. The element is saved as the last element found. default rank : 1 optional rank compatibility : universal |
findParentLastElementFound | Â | Finds the parent of the last element found. The parent is saved and replaced the last element found. compatibility : universal |
findChildByClassLastElementFound |
| Finds the first child of the last element found using the given class as selector. The parent is saved and replaced the last element found. compatibility : universal |
findChildByIndexLastElementFound |
| Find by index a child of the last element found. The Index matches the index in the screen dump. default rank : 0 optional rank compatibility : universal |
Form
Command | Example | Description |
---|---|---|
formClickOnFirstEmptyEditText | Â | Clicks on the first empty edit text. compatibility : universal |
formClickOnEditText |
| Clicks on the nth edit text. 1 is the first element. default rank : 1 optional rank compatibility : universal |
formClickOnCheckbox |
| Clicks on the nth checkbox. 1 is the first element. default rank : 1 optional rank compatibility : universal |
Keyboard
Command | Example | Description |
---|---|---|
performIMEAction | Â | Presses the blue button of the Gboard to perform the IME action highlighted (search, done, next, enter ...) |
Network
Command | Example | Description |
---|---|---|
enableWifi | Â | Enables the wifi on the device. |
disableWifi | Â | Disables the wifi on the device. |
enableData | Â | Enables the mobile data on the device. |
disableData | Â | Disables the mobile data on the device. |
enableBluetooth | Â | Enables the bluetooth on the device. compatibility : universal |
disableBluetooth | Â | Disables the bluetooth on the device. compatibility : universal |
enableNFC | Â | Enables the NFC on the device. |
disableNFC | Â | Disables the NFC on the device. |
enableAirplaneMode | Â | Enables airplane mode on the device. |
disableAirplaneMode | Â | Disables airplane mode on the device. |
switchActiveNetworkToMode |
| Disables the wifi, activates the data and switches to the given network mode. (The network has to be active in less than 20s.) |
switchNetworkMode |
| Switches the network mode to the given one. |
OTP
Command | Example | Description |
---|---|---|
authInitOTPManual |
| Inits OTP to use with manual actions. The command checks that the url point to a json file in the correct format {"value"=""}, the value must be an empty string. When your application or site uses OTP authentication, you can manually use a public JSON file to communicate the OTP code to GDSL. compatibility : universal |
authInitOTPMailsac |
| Inits OTP to use with mailsac. This command uses mailsac email and api key to clear message in your inbox. After calling this command, you can log in on your app or website with the mailsac email. compatibility : universal |
authWaitAndStoreOTP | Â | Waits for the OTP to become available and stores it in memory. The command tries to get the OTP which need to be an expression of 4-20 digits during a maximum of 10 minutes. compatibility : universal |
authEnterStoredOTP | Â | Enters the stored OTP (previously stored in memory) in the current selected field by clicking on the keyboard keys for each character. compatibility : universal |
Probe
Command | Example | Description |
---|---|---|
measureStart |
| Starts a measure which can be identified by the given name. compatibility : universal |
measureStop | Â | Stops the current measure. compatibility : universal |
Screen
Command | Example | Description |
---|---|---|
setLandscapeOrientation | Â | Sets device orientation to landscape. compatibility : universal |
setPortraitOrientation | Â | Sets device orientation to portrait. compatibility : universal |
screenSetLuminosity |
| Changes the screen brightness according to the given value. The new screen brightness value should be between 0 and 255. If out of bounds, the closest value in bounds is taken. compatibility : universal |
screenUnlock | Â | Unlocks the screen. Works only if no unlock securities are presents. compatibility : universal |
screenTurnOnAndUnlock | Â | Turns on the device and unlocks the screen if necessary. |
screenTurnOnAndUnlockAndEnterPIN |
| Turns on the device, unlocks the screen and enter PIN |
screenTurnOff | Â | Turns off the device. compatibility : universal |
setWallpaper |
| Sets the wallpaper with an image file. |
clearWallpaper | Â | Clears the wallpaper by putting the device factory wallpaper (android version >= 28 or P) |
Screenshot
Command | Example | Description |
---|---|---|
takeScreenshot |
| Takes a screenshot. The screenshot will be saved on the file with name fileName.png. When screenshot can't be taken, if true, the test continues ignoring the error, if false, the test stops and throws the error. default boolean : false optional boolean compatibility : universal |
Scroll
Command | Example | Description |
---|---|---|
scrollDownwardUntilEnd | Â | Scrolls downward until the end of the screen (max : 20 scrolls) compatibility : universal |
scrollUpwardUntilBeginning | Â | Scrolls upward until the beginning of the screen (max : 20 scrolls) compatibility : universal |
scrollLeftwardUntilEnd | Â | Scrolls leftward until the end of the screen (max : 20 scrolls) compatibility : universal |
scrollRightwardUntilBeginning | Â | Scrolls rightward until the beginning of the screen (max : 20 scrolls) compatibility : universal |
scrollDownward | Â | Scrolls downward the screen (only one scroll). compatibility : universal |
scrollUpward | Â | Scrolls upward the screen (only one scroll). compatibility : universal |
scrollLeftward | Â | Scrolls leftward the screen (only one scroll). compatibility : universal |
scrollRightward | Â | Scrolls rightward the screen (only one scroll). compatibility : universal |
scrollToText |
| Scrolls vertically or horizontally to find the exact text. default boolean : false optional boolean compatibility : universal |
swipeRightward |
| Swipes rightward the screen. The swipe gesture is from screen point A (X 90%, Y percY) to screen point B (X 10%, Y percY). compatibility : universal |
swipeLeftward |
| Swipes leftward the screen. The swipe gesture is from screen point A (X 10%, Y percY) to screen point B (X 90%, Y percY). compatibility : universal |
swipeUpward |
| Swipes upward the screen. The swipe gesture is from screen point A (X percX, Y percStartY) to screen point B (X percX, Y 90%). default percx : 50 default percstarty : 10 optional perc compatibility : universal |
swipeUpwardToText |
 | Swipes upward to find the first element which text or content-desc contains the given selector. The swipe gesture is from screen point A (X 50%, Y 10%) to screen point B (X 50%, Y 90%). CASE-SENSITIVE default iterations : 10 (max 30) default percx: 50 optional iterations and percx compatibility : universal |
swipeDownward |
| Swipes downward the screen. The swipe gesture is from screen point A (X percX, Y percStartY) to screen point B (X percX, Y 10%). default percx : 50 default percstarty : 90 optional perc compatibility : universal |
swipeDownwardToText |
| Swipes downward to find the first element which text or content-desc contains the given selector. The swipe gesture is from screen point A (X 50%, Y 90%) to screen point B (X 50%, Y 10%). case-insensitive default iterations : 10 (max 30) compatibility : universal |
swipeVertical |
| Swipes vertically the screen. The swipe gesture is from screen point A (X percX, Y percStartY) to screen point B (X percX, Y percEndY). default duration : 500 optional duration compatibility : universal |
swipeHorizontal |
| Swipes horizontally the screen. The swipe gesture is from screen point A (X percStartX, Y percY) to screen point B (X percEndX, Y percY). default duration : 500 optional duration compatibility : universal |
Set Text
Command | Example | Description |
---|---|---|
setTextByText |
| Pastes the given text into the element which contains the given text selector. compatibility : universal |
setTextByDesc |
| Pastes the given text into the element which contains the given desc selector. compatibility : universal |
setTextByTextExact |
| Pastes the given text into the element which has the given exact text selector. compatibility : universal |
setTextById |
| Pastes the given text into the element which contains the given id selector. compatibility : universal |
enterText |
| Enters the given text in the current selected field clicking on the keyboard keys for each character. Text is entered character by character at the given frequency optional frequency compatibility : universal |
setTextLastElementFound |
| Pastes the given text in the last found element. compatibility : universal |
enterTextFast |
| Taps the text specified in parameter. Enter all text at once. compatibility : universal |
Settings
Command | Example | Description |
---|---|---|
openSettingsMenuWithName |
| Opens the menu described by the given name in the device settings. The menu name may be distinct depending on the phone model or Android version, so you can try various names using "|". "Preferred network|network mode" → if the "Preferred network" menu is not found, the command attempts to open the "Network mode" menu |
UIAutomator Configuration
Command | Example | Description |
---|---|---|
setCompressedLayoutHierarchy |
| Enables or disables layout hierarchy compression. This general configuration for uiautomator can be called at any time during a GDSL test. If compression is enabled, the layout hierarchy derived from the Accessibility framework will only contain nodes that are important for uiautomator testing. Any unnecessary surrounding layout nodes that make viewing and searching the hierarchy inefficient are removed. compatibility : universal |
setWaitForIdle |
| Sets the timeout for waiting for the user interface to go into an idle state before starting a uiautomator action. This general configuration for uiautomator can be called at any time during a GDSL test. compatibility : universal |
Wait Object
Command | Example | Description |
---|---|---|
waitIdle | Â | Waits for device idle. Only use in specific cases for web view refresh issues. compatibility : universal |
waitUntilText |
| Waits for a view element with text specified, to become visible on the screen until a specified timeout. If it is not found, an error is thrown. CASE-inSENSITIVE default timeout: 30000 optional timeout compatibility : universal |
waitUntilDesc |
| Waits for a view element with content-desc specified, to become visible on the screen until a specified timeout. If it is not found, an error is thrown. CASE-inSENSITIVE default timeout: 30000 optional timeout compatibility : universal |
waitUntilTextBeforeClick |
| Waits for a view element with text specified, to become visible on the screen and then clicks on it. If false, it waits 10 second max before the error thrown. If true, it waits 2 seconds max. default boolean : false optional boolean compatibility : universal |
waitUntilDescBeforeClick |
| Waits for a view element with content-desc specified, to become visible on the screen and then clicks on it. If false, it waits 10 second max before the error thrown. If true, it waits 2 seconds max. default boolean : false optional boolean CASE-inSENSITIVE compatibility : universal |
waitUntilTextExact |
| Waits for a view element, with the exact text selected, to become visible on the screen until a specified timeout. If it is not found, an error is thrown. CASE-SENSITIVE default timeout: 30000 optional timeout compatibility : universal |
waitUntilTextExactBeforeClick |
| Waits for a view element, with the exact text selected, to become visible on the screen and then clicks on it. If false, it waits 10 second max before the error thrown. If true, it waits 2 seconds max. CASE-SENSITIVE default boolean : false optional boolean compatibility : universal |
waitUntilDescExact |
| Waits for a view element, with the exact content-desc selected, to become visible on the screen until a specified timeout. If it is not found, an error is thrown. CASE-SENSITIVE default timeout: 30000 optional timeout compatibility : universal |
waitUntilDescExactBeforeClick |
| Waits for a view element, with the exact content-desc selected, to become visible on the screen and then clicks on it. If false, it waits 10 second max before the error thrown. If true, it waits 2 seconds max. CASE-SENSITIVE default boolean : false optional boolean compatibility : universal |
waitUntilId |
| Waits for a view element, with the exact id selected, to become visible on the screen until a specified timeout. If is not found, an error is thrown. default timeout: 30000 optional timeout compatibility : universal |
waitUntilIdBeforeClick |
| Waits for a view element, with the exact id selected, to become visible on the screen and then clicks on it. If false, it waits 10 second max before the error thrown. If true, it waits 2 seconds max. default boolean : false optional boolean compatibility : universal |
waitUntilGoneId |
 | Waits until there is no view element, with the exact id selected, visible on the screen until a specified timeout. If it is still found, an error is thrown. default timeout: 30000 optional timeout compatibility : universal |
waitUntilGoneText |
| Waits until there is no view element, with text selected, visible on the screen until a specified timeout. If it is still found, an error is thrown. CASE-inSENSITIVE default timeout: 30000 optional timeout compatibility : universal |
waitUntilGoneTextExact |
| Waits until there is no view element, with the exact text selected, visible on the screen until a specified timeout. If it is still found, an error is thrown. CASE-SENSITIVE default timeout: 30000 optional timeout compatibility : universal |
waitUntilGoneDesc |
| Waits until there is no view element, with content-desc selected, visible on the screen until a specified timeout. If it is still found, an error is thrown. CASE-inSENSITIVE default timeout: 30000 optional timeout compatibility : universal |
waitUntilGoneDescExact |
| Waits until there is no view element, with content-desc selected, visible on the screen until a specified timeout. If it is still found, an error is thrown. CASE-SENSITIVE default timeout: 30000 optional timeout compatibility : universal |
waitUntilGoneClass |
| Waits until there is no view element, with class selected, visible on the screen until a specified timeout. If it is still found, an error is thrown. default timeout: 30000 optional timeout compatibility : universal |
waitUntilWindowUpdate |
| Waits for a window content update event to occur. The specified window package name can be null. If null, a window update from any front-end window will end the wait. compatibility : universal |
Zoom
Command | Example | Description |
---|---|---|
pinchInById |
| Pinches in the element with id selected according to a percentage of the object's diagonal length. If a too large duration and small percentage are used, nothing may happen. default duration: 500 optional duration compatibility : universal |
pinchOutById |
| Pinches out the element with id selected according to a percentage of the object’s diagonal length. If a too large duration and small percentage are used, nothing may happen. default duration: 500 optional duration compatibility : universal |
pinchInByText |
| Pinches in the element with text selected according to a percentage of the object’s diagonal length. If a too large duration and small percentage are used, nothing may happen. CASE-inSENSITIVE default duration: 500 optional duration compatibility : universal |
pinchOutByText |
| Pinches out the element with text selected according to a percentage of the object’s diagonal length. If a too large duration and small percentage are used, nothing may happen. CASE-inSENSITIVE default duration: 500 optional duration compatibility : universal |
Â