Appium iOS can't go to Home screen

1.2k Views Asked by At

Im using Appium to test my iOS app on real device. During the test I need to go to the home screen (I must do so) but can't find a way to do it.

I found here that there is an option to use the accessibility for Home button- Appium iOS can't inspect notification layer

but how can I click on this? Appium doesn't recognized this button.

Any suggestions?

3

There are 3 best solutions below

0
dmle On

Using Appium Java client you can switch to Home screen on iOS the same way as on Android:

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

0
Lukic Nikola On

You should run:

driver.executeScript("mobile: pressButton", ImmutableMap.of("name", "home"));

Look at this post.

0
j.rmz87 On
driver.executeScript("mobile: pressButton", ImmutableMap.of("name", "home"));

Note: driver must be of type AppiumDriver, if not you need to cast it