Appium iOS- How can I go to Home screen

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/593

1 Like

Great :slight_smile:

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);

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

Exactly the same code as iOS, just use the android package name

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.

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?

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.

Hi @Telmo_Cardoso
I need your help. I need to automate the 3D touch iphoneX.

Can you please guide me.

ThankQ