1 - Introduction
2 - List of text input commands
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 Set Text
setTextByText,[TEXT],[TEXT-SELECTOR]
setTextByDesc,[TEXT],[DESC-SELECTOR]
setTextByText,[TEXT],[EXACT-TEXT-SELECTOR]
setTextById,[TEXT],[ID-SELECTOR]
enterText,[TEXT]
enterText,[TEXT],[FREQUENCY]
setTextLastElementFound,[TEXT]
enterTextFast,[TEXT]
3 - Use case
Use case 1 : Fill a form
The Kwit application login form contains an "Email" field that can be accessed with its text and Android class.
Be careful, the text above “Sign in with your Email” contains also the text “Email”.
To select the form field, use the clickByTextExact
function or access to it with its Android class: android.widget.EditText.
It is therefore possible to use the formClickOnEditText
function with the position of the text field as a parameter. If no parameter is supplied, the first field is selected by default.
There's also the formClickOnFirstEmptyEditText
function, which can be used to select the first empty text field. This is not useful in our case, as the "Email" field is already pre-filled.
This is what you get after entering your email address:
Then pressTab
to move on to the next field.
Example :
### Quick preparation of the device applicationStart,fr.kwit.android waitUntilText,Already an account # Click on the element "Already an account" clickByText,Already an account waitUntilText,Sign Up # Click on the element "Other Sign in methods" clickByPercent,50,85 waitUntilText,Other Sign in methods # Click on the element "Email" clickByPercent,50,92 waitUntilText,Sign in with your Email ### Fill the form measureStart,ACTION_loginPage_fillForm formClickOnEditText enterText,test@gmail.com pressTab enterText,12345678 pause,${PAUSEAFTERLOAD} measureStop
Use case 2 : Fields are not accessible via their text, id or description
The website https://www.sante.fr contains fields that are not accessible via their text, description or identifier.
However, both fields have the following Android class: android.widget.EditText.
You can use the GDSL function formClickOnFirstEmptyEditText
which clicks on the first empty text field.
Example :
### Quick preparation of the device setBrowser,chrome launchBrowser browserClearCache browserCloseAllTabs browserNewTab browserGoToUrl,https://www.sante.fr pressEnter # Accept cookies waitUntilText,Tout accepter clickByText,Tout accepter waitUntilText,L'information fiable ### Fill the form measureStart,ACTION_homePage_fillForm formClickOnFirstEmptyEditText enterText,pediatre pressTab enterText,Hauts-de-Seine pause,${PAUSEAFTERLOAD} measureStop
After the enterText function, do not write special or accented characters, as they are not taken into account.