Closing app, leaving background process

I have two drivers, one for my app and one for Chrome.

The flow is like so:

  1. Start the app driver, set up the app (app starts background process).
  2. Start the Chrome driver, do some stuff there and quit this driver.

But what I actually want to do is this:

  1. Start the app driver, set up the app (app starts background process).
  2. Close this app, but leave the background process running
  3. Start the Chrome driver, do some stuff there and quit this driver.
  4. Open back up the app which I have closed in step 2

Quitting the driver ( driver.quit() ) is obviously not an option, since this also kills the background process. Same as with ( driver.close_app() ).

I was thinking about doing this via UI, by simply clicking the “Recent Button” and swiping up on my app, but how would I then get back the app?

My question: Is it possible to close the app without killing the background process, if so - how?

driver.runAppInBackground(Duration.ZERO); // = send app into background
1 Like

That’s exactly what I have been looking for, thank you.