What is the best way to turn airplane mode on and off using calabash-android?
Can I use perform_action(\'set_preferences\', .... )
??
What does set_
For Android devices, we can use this code in Step definition to forget Wi-Fi which is connected:
do
%x(adb shell am start -a android.intent.action.MAIN -n com.android.settings/.wifi.WifiSettings)
%x(adb shell input keyevent 20)
%x(adb shell input keyevent 23)
%x(adb shell input keyevent 20)
%x(adb shell input keyevent 23)
end
Your question is a bit vague. Is it for simulator or device?
In case you just need to disable wifi, you could use
def disable_network
%x(adb shell svc wifi disable)
end
def enable_network
%x(adb shell svc wifi enable)
end
Found here https://azevedorafaela.wordpress.com/tag/disable-wifi-android-simulator-calabash/ I have not tried it myself though.