This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.
21 / 31
Feb 2018

on real ios devices thats not possible. For simulator I think there are scripts around to do that. But if you just want to go to homescreen you dont need to tap the home button, just use the above command.

I have one doubt, above method will send the app in the background, but only for particular period of time which we will provide and in the process of sending app into background and then launching again after the provided time, how we will perform actions on homescreen between the process?

The -1 in the duration makes that it doesn’t goes back to app automatically :wink:

Test it:

driver.runAppInBackground(Duration.ofSeconds(-1));

This change is based on appium/appium-xcuitest-driver#381, which makes possible to minimize the application under test and then return to iOS springboard (emulates clicking Home button).

From https://github.com/appium/java-client/pull/59318

12 days later

Hi After using driver.runAppInBackground(Duration.ofSeconds(-1));, how to return to the same app. Can you please help

If you are using latest Appium/Java Client use:

driver.activateApp(bundle_id);
8 months later

Hi how can I do the same process for Android,

driver.runAppInBackground(Duration.ofSeconds(-1));
is working for me to go Homepage but how can I back from home to my app in android? thanks

Thank you for your response, with app package, it launches the app from the first point which required Login, I want to just back the same page as I left the app and see the prompt message.
Do you have any suggestion?
but with this

driver.activateApp ( “app package”, null );
driver.navigate ().back ();

it works now but I think there is another better way for it.

2 months later

Reading this thread, I don’t think you got the credit you deserve for answering all these questions. Thanks, Telmo. Just curious, where there any ‘roadblocks’ you hit while accessing iOS elements [non-app specific] that you had to overcome?

1 month later

Hi @Telmo_Cardoso I performed some actions on the screen and the want to go to the application’s home screen. How to do that. driver.navigate.back(); is also not working please suggest anything. I am automation my app with IOSDriver.