Skip to main content

Swipe by Coordinates

The Swipe by Coordinates action performs a swipe gesture between two specific points on the screen. Unlike the Swipe action, this method gives you precise control over where the gesture starts and ends.

When to Use​

Use this action when you want to:

  • Perform custom swipe gestures.
  • Interact with drawing applications.
  • Swipe inside maps.
  • Navigate custom UI components.
  • Perform gestures where direction-based swiping is insufficient.

Syntax​

var task = suremdmjs.automate().swipeCoordinates(
"<Start X,Y>",
"<End X,Y>"
);

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

Parameters​

ParameterRequiredDescription
Start X,YYesStarting screen coordinate in "x,y" format.
End X,YYesEnding screen coordinate in "x,y" format.

Parameter Details​

Start X,Y​

Specifies the location where the swipe begins.

Example:

300,1500

End X,Y​

Specifies the location where the swipe ends.

Example:

300,500

Example​

!#suremdmjs

performSwipe();

function performSwipe() {

var task = suremdmjs.automate().swipeCoordinates(
"300,1500",
"300,500"
);

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

}

function onSwipeCompleted() {
suremdmjs.log("Swipe completed.");
}

function onFailure() {
suremdmjs.log("Swipe failed.");
}

How This Example Works​

  1. Defines the swipe start position.
  2. Defines the swipe end position.
  3. Performs the gesture between both coordinates.
  4. Executes the success callback.

Expected Result​

A swipe gesture is performed between the specified screen coordinates.

note

Coordinates are measured in screen pixels and may differ across devices with different screen sizes or display resolutions.

💬 Help us improve this documentation

Was this information useful?

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