Set text - operation¶
- Android
- Apple iPhone / iPad (iOS)
- Apple iOS Simulator
- Apple TV (tvOS)
- Apple tvOS Simulator
- Browsers
- HbbTV / Freeview Play
- LG webOS
- NextGen TV / ATSC 3.0
- PlayStation 4/5
- Roku (not Lite)
- Samsung Tizen
- Sky
- VIDAA
- Vizio SmartCast
- Xbox (One, Series X/S)
- Xfinity / Xumo TV / XClass TV
- Xumo (Entertainment OS)
- Other Smart TVs and STBs - HTML apps
This operations sets text of an element such as a text field / input to specified string.
In HTML-based apps, Set text is supported on
contenteditable
elements and most of<input>
types (excl.button
,checkbox
,color
,file
,hidden
,image
,radio
,range
,reset
).
Set text basics¶
To perform this operation in the Suitest Test editor use the Set text line:
To perform this operation in the Suitest JavaScript API use
the setText
command:
await assert.element('loginTextBox').exists().timeout(2000);
await assert.element('loginTextBox').setText('login@suite.st');
await assert.element('passwordTextBox').setText('myPassWord');
Set text only if a specific condition is met¶
You can combine the Set text operation with an Assertion and instruct Suitest to run this operation only if the condition is satisfied.
In JavaScript API:
if (await suitest.element('loginTextBox').matches([
PROP.HEIGHT,
PROP.LEFT,
PROP.TOP,
PROP.WIDTH,
])) {
await assert.element('loginTextBox').setText('login@suite.st');
}
if (await suitest.element('passwordTextBox').exists()) {
await assert.element('passwordTextBox').setText('myPassWord');
}