Scroll Until Check with Timeout
The Scroll Until Check with Timeout action scrolls the screen until the specified UI element is found or confirmed to be absent, within a configurable timeout. Unlike Scroll Until Check, this action allows you to define how long the automation should continue searching before the verification fails. This action performs verification only. It does not click or modify the target element.
When to Use
Use this action when you want to:
- Verify that a settings option exists within a specified time.
- Confirm that an application feature is available.
- Check whether an expected item appears in a dynamically loaded list.
- Verify that an element is no longer present.
- Limit the time spent searching for an element before continuing with failure handling.
Syntax
var task = suremdmjs.automate().scrollUntilCheck(
"<Package Name>",
"<Direction>",
"<Element Text>",
<Checked>,
<Timeout in Milliseconds>
);
suremdmjs.automate().performAction(
task,
"onSuccess",
"onFailure"
);
Parameters
| Parameter | Required | Description |
|---|---|---|
| Package Name | Yes | Package name of the target application. Leave empty ("") to search all applications. |
| Direction | Yes | Scroll direction. Supported values are up, down, left, and right. |
| Element Text | Yes | Visible text of the element to verify. |
| Checked | Yes | Pass true to verify that the element is present, or false to verify that the element is not present. |
| Timeout | Yes | Maximum time, in milliseconds, to complete the verification before the action fails. |
Parameter Details
Checked
| Value | Description |
|---|---|
| true | Verifies that the specified element is present. |
| false | Verifies that the specified element is not present. |
Timeout
Specifies the maximum time allowed for the verification operation.
| Value | Description |
|---|---|
| 5000 | Waits for up to 5 seconds. |
| 20000 | Waits for up to 20 seconds. |
| 60000 | Waits for up to 60 seconds. |
Example
The following example verifies whether the Suppress Notification Panel setting is available within 20 seconds.
!#suremdmjs
verifySetting();
function verifySetting() {
var task = suremdmjs.automate().scrollUntilCheck(
"",
"up",
"Suppress Notification Panel",
true,
20000
);
suremdmjs.automate().performAction(
task,
"settingFound",
"settingMissing"
);
}
function settingFound() {
suremdmjs.log("Setting found.");
}
function settingMissing() {
suremdmjs.log("Setting could not be located within 20 seconds.");
}
How This Example Works
- Starts scrolling upward through the current screen.
- Searches for the Suppress Notification Panel setting.
- Continues searching for up to 20 seconds.
- Verifies that the setting is present without interacting with it.
- Executes the success callback if the setting is found, or the failure callback if verification does not succeed within the timeout.
Expected Result
The automation confirms whether the Suppress Notification Panel setting is available within 20 seconds, without clicking or modifying it.
Scroll Until Check with Timeout is intended for verification only. The Checked parameter determines whether the automation verifies the presence or absence of the specified element. It does not represent or modify the checked state of a checkbox.