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:

- inputText: "string"

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

- inputText:
    text: "[email protected]"
    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.

circle-exclamation

Random text input commands

Maestro provides several commands to input randomly generated data. These commands use the DataFakerarrow-up-right library.

Command
Description

inputRandomEmail

Inputs a random email address.

inputRandomPersonName

Inputs a random person's name.

inputRandomNumber

Inputs a random integer.

inputRandomText

Inputs random unstructured text.

inputRandomCityName

Inputs a random city name.

inputRandomCountryName

Inputs a random country name.

inputRandomColorName

Inputs a random color name.

Parameters for random text commands

You can specify the length for certain random input commands.

Parameter
Type
Applicable Commands
Description

length

integer

inputRandomNumber and inputRandomText

Specifies the number of digits or characters to generate. The default is 8.

Usage examples

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

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

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.

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.

Last updated