|This method is available in legacy mobile tests that work with devices connected to the local computer. To learn how to simulate user actions in newer cloud-compatible mobile tests, see the Simulating user actions in tests section.|
SetText action sets the textual contents of a control, that is, replaces the existing contents with the specified text and then emulates touching the enter (return) key.
|TestObj||A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section|
The method is applied to the following objects:
The method has the following parameter:
The text to enter in the control. To enter multi-line text in a multi-line control, separate the lines by using new line characters or the corresponding constants.
SetTextaction fails when it is called for a disabled or read-only control.
To get a control’s text, use the
wTextproperty. You can also use it to set text without posting a notification to the log.
To enter text in certain place within a control, to simulate keystrokes in a control or to simulate character-by-character input, use the
To view an example that demonstrates how to use the
SetText method to enter text into an Android text edit control, see Entering Text into an Edit Text Control.
For an example that demonstrates how to use the
SetText method to enter text in an iOS text edit control, see Entering Text in an Edit Control.
If you use the Android onscreen keyboard during the test recording, TestComplete may detect and record the Backspace key input incorrectly. To work around this issue, use the TestComplete Android Agent keyboard to record keyboard input.
To learn more about installing and enabling the TestComplete Android Agent keyboard, see About TestComplete Android Agent Keyboard (Legacy).
To learn about other issues that may occur when testing Android applications, see Possible Issues With Android Applications (Legacy).