Go Back
The Go Back action simulates pressing the Android Back button. It returns to the previous screen or closes the currently displayed dialog, depending on the application's navigation behaviour.
When to Use
Use this action when you want to:
- Return to the previous screen.
- Close a dialog or popup.
- Exit a settings page.
- Navigate backwards during an automation workflow.
Syntax
var task = suremdmjs.automate().goBack();
suremdmjs.automate().performAction(
task,
"onSuccess",
"onFailure"
);
Parameters
This action does not require any parameters.
Example
!#suremdmjs
goToPreviousScreen();
function goToPreviousScreen() {
var task = suremdmjs.automate().goBack();
suremdmjs.automate().performAction(
task,
"backCompleted",
"backFailed"
);
}
function backCompleted() {
suremdmjs.log("Returned to the previous screen.");
}
function backFailed() {
suremdmjs.log("Unable to navigate back.");
}
Expected Result
The device navigates to the previous screen.