Skip to main content

Long Press Element

The Long Press Element action performs a long press on a UI element identified by its visible text.

Typical Use Cases

  • Opening context menus.
  • Selecting applications.
  • Entering edit mode.
  • Displaying additional options.

Syntax

var task = suremdmjs.automate().longPress(
"<Package Name>",
"<Element Text>"
);

Example

var task = suremdmjs.automate().longPress(
"",
"Chrome"
);

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

Expected Result

The Chrome application icon is long pressed and its context menu is displayed.

💬 Help us improve this documentation

Was this information useful?

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