Skip to content

inputText ​

Type text into focused input fields with optional keyboard handling.

the inputText command inputs a specified text string. This command works even if no text field is focused.

Syntax ​

You can use the shorthand string syntax for quick inputs:

yaml
- inputText: "string"

You can also use the expanded syntax to include the label:

yaml
- inputText:
    text: "user@example.com"
    label: "Input the test system username"

The label parameter provides real-world context in your test reports, making it clear what specific data is being entered during that step.

WARNING

Unicode characters are not supported on Android. See GitHub issue #146 for status updates.

Random text input commands ​

Astra Scout provides several commands to input randomly generated data.

CommandDescription
inputRandomEmailInputs a random email address.
inputRandomPersonNameInputs a random person's name.
inputRandomNumberInputs a random integer.
inputRandomTextInputs random unstructured text.
inputRandomCityNameInputs a random city name.
inputRandomColorNameInputs a random color name.
inputRandomCountryNameInputs a random country name.

Setting the length ​

The shorthand commands above take no parameters. To control the length, use inputRandom with a type (TEXT, NUMBER, EMAIL or PERSON_NAME) and a length:

ParameterTypeDescription
typestringTEXT (default), NUMBER, EMAIL or PERSON_NAME.
lengthintegerNumber of characters (TEXT) or digits (NUMBER) to generate. The default is 10. Ignored for other types.

INFO

inputRandomCityName, inputRandomCountryName and inputRandomColorName pick a value from a small built-in list. They take no length.

Usage examples ​

You can use the inputText command to add a specific string:

yaml
- inputText: "Hello World"

You can also input a random number or text with a specific length:

yaml
- inputRandom:
    type: NUMBER
    length: 9
- inputRandom:
    type: TEXT
    length: 11

Reuse a random value in an assertion ​

This example inputs a random string, copies it to a variable, and then asserts that the copied text is visible on the next screen.

yaml
- tapOn:
    id: MyTextInput
- inputRandomText
- copyTextFrom:
    id: MyTextInput
- tapOn: 'Submit'
- assertVisible: ${maestro.copiedText}

In this example, copyTextFrom stores the copied text in the copiedText variable. This value is then used by assertVisible to verify that the generated text appears on the new screen after tapping the Submit button.

Use variables ​

You can input dynamic data stored in variables or the results of JavaScript expressions.

yaml
# Input text from an environment variable or previous output
- inputText: ${USER_EMAIL}

# Input using complex logic
- inputText: ${'testuser_' + Math.floor(Math.random() * 1000)}

WARNING

On iOS simulators, inputText can fail on password fields (secureTextEntry) because of iOS Password AutoFill.