user650309
user650309

Reputation: 2899

How to close an iOS app on a real device using appium

I'm using appium to automate some tests but I want the application under test to return to the same start in between tests. I think that the easiest way to do this would be to close and reopen the app. Is this possible with appium? If so, how?

(Note: driver.close() does not work)

Upvotes: 1

Views: 3514

Answers (1)

Dan Cuellar
Dan Cuellar

Reputation: 269

You can do this with driver.quit(). You will need to reconnect but as long as the server is launched with the --no-reset switch it should boot up in the state where you left it.

You could also background the app as an alternative using executeScript with "mobile: background" (see https://github.com/mutualmobile/appium/commit/53f0c58857eec512f48732d40ace71b7db4ae32f) or calling the UIAutomation command directly with executeScript. (e.g. au.background(5)) for 5 seconds in the background.

Upvotes: 1

Related Questions