Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

Version 1 Current »


1 - Introduction

2 - List of text input commands

Set Text

Command

Example

Description

setTextByText

setTextByText,[TEXT],[TEXT-SELECTOR]

Pastes the given text into the element which contains the given text selector.

COMPATIBILITY : UNIVERSAL

setTextByDesc

setTextByDesc,[TEXT],[DESC-SELECTOR]

Pastes the given text into the element which contains the given desc selector.

COMPATIBILITY : UNIVERSAL

setTextByTextExact

setTextByText,[TEXT],[EXACT-TEXT-SELECTOR]

Pastes the given text into the element which has the given exact text selector.

COMPATIBILITY : UNIVERSAL

setTextById

setTextById,[TEXT],[ID-SELECTOR]

Pastes the given text into the element which contains the given id selector.

COMPATIBILITY : UNIVERSAL

enterText

enterText,[TEXT]

enterText,[TEXT],[FREQUENCY]

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

setTextLastElementFound,[TEXT]

Pastes the given text in the last found element.

COMPATIBILITY : UNIVERSAL

enterTextFast

enterTextFast,[TEXT]

Taps the text specified in parameter. Enter all text at once.

COMPATIBILITY : UNIVERSAL

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.

  • No labels