Skip to main content

Click Element (with Timeout)

The Click Element with Timeout action waits for a specified amount of time for a UI element to appear. Once the element becomes available, it performs the click action automatically. Unlike Click Element, this action is useful when the target element is expected to appear after a loading screen, animation, or background operation.

When to Use​

Use this action when:

  • Waiting for a login button to appear.
  • Waiting for an installation dialog.
  • Waiting for a loading screen to finish.
  • Waiting for dynamically loaded content.

Syntax​

var task = suremdmjs.automate().clickWithTimeout(
"<Package Name>",
"<Element Text>",
<Timeout in Milliseconds>
);

suremdmjs.automate().performAction(
task,
"onSuccess",
"onFailure"
);

Parameters​

ParameterDescription
Package NamePackage containing the target element. Leave empty to search all applications.
Element TextVisible text of the element.
TimeoutMaximum time to wait before failing.

Parameter Details​

Timeout​

Specifies how long the automation should wait before giving up.

Example:

5000
waits for 5 seconds.

30000
waits for 30 seconds.

Example​

var task = suremdmjs.automate().clickWithTimeout(
"",
"Install",
60000
);

suremdmjs.automate().performAction(
task,
"installationStarted",
"installationFailed"
);

How This Example Works​

The automation waits for up to 60 seconds for the Install button. If found, it clicks the button. Otherwise, the failure callback is executed.

💬 Help us improve this documentation

Was this information useful?

Your feedback helps us keep our documentation accurate, up to date, and useful.