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

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

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 .

I have found this in the appium documentation for appium.

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?


No standard way to do it, however one can emulate the normal user behaviour like it is described in

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?

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

Any idea how to turn on/off network on android using Appium C# libraries?