I need to implement the following scenario in Python for both Android and iOS:
A. I have a native app already opened on a real device.
B. I want to push the app in the background in order to have access to Home screen of the device.
C. I want to switch wifi to ON or OFF (I implemented already this step)
D. I want to add the app back in the foreground exactly from where I remained (without reset, reinstall etc).
I’m struggling with steps B and D.
Lets take this example:
- print(’ Now lets switch Wi - Fi’)
If I’m using driver.background_app(), I noticed that print() is executed only AFTER the 15 seconds passed and the native app is already again in the foreground. But I want to reach step 2 WHILE the app is still in the background, to execute print (or in my real case to switch WiFi) and only after that to bring the app back in the foreground.
Also is there a solution to push the app in the background without giving the number of seconds and EXACTLY after I finish the steps between (like switching WiFi), to add the the app back in the foreground with maybe another command?
I hope it makes sense the above scenario…