Long Press by Coordinates
The Long Press by Coordinates action performs a long press at the specified screen coordinates. It is commonly used to open context menus, enter selection mode, or display additional options.
When to Use
Use this action when you want to:
- Open a context menu.
- Select application icons.
- Enter edit mode.
- Perform drag-and-drop preparation.
Syntax
var task = suremdmjs.automate().longPressCoordinates(
<X Coordinate>,
<Y Coordinate>
);
suremdmjs.automate().performAction(
task,
"onSuccess",
"onFailure"
);
Parameters
| Parameter | Required | Description |
|---|---|---|
| X Coordinate | Yes | Horizontal screen coordinate in pixels. |
| Y Coordinate | Yes | Vertical screen coordinate in pixels. |
Example
!#suremdmjs
selectIcon();
function selectIcon() {
var task = suremdmjs.automate().longPressCoordinates(
350,
750
);
suremdmjs.automate().performAction(
task,
"selectionOpened",
"selectionFailed"
);
}
function selectionOpened() {
suremdmjs.log("Long press completed.");
}
function selectionFailed() {
suremdmjs.log("Unable to perform long press.");
}
Expected Result
The specified screen location receives a long press, and the associated context menu or selection mode is displayed.