Change mobile state to offline mode/Airplane mode on Android and iOS?


#21

How did you arrived the control center? I always get a point is not within the bounds of the screen exception, even though im inside the valid screen.
The maximum Y value to tap is 600 before the exceptions comes but the screensize of my iphone is 375x 667


#22

Hi KalveeduVJ,

Can you please give the java code for ios11 realdevice to switch from offline to online and online to offline. and to navigate to the testing app .


#23

I have found this in the appium documentation for appium.

http://appium.io/docs/en/commands/device/network/toggle-airplane-mode/#appium-clients

POST /session/:session_id/appium/device/toggle_airplane_mode

Is there any java example using this? How do we make the POST call on the driver?


#24

Android:


iOS:
No standard way to do it, however one can emulate the normal user behaviour like it is described in https://appiumpro.com/editions/15


#25

Thank you @mykola-mokhnach. I will give this a try.

One clarification question. The comment states that:
“This option only works up to Android 6.”

Any idea this will work for Android 7 or above?


#26

Regarding Android 7+ this is OS-level limitation.

Although, you could try to do the same trick as for iOS - emulate user actions by opening system settings and switching the state there if you don’t care about the support of multiple devices