使用calabash-android打开和关闭飞行模式的最佳方法是什么?
我可以使用perform_action('set_preferences', .... )
??
set_preferences做了什么?我想在测试应用程序时设置android设置。
由于
答案 0 :(得分:3)
你的问题有点模糊。是模拟器还是设备?
如果你只需要禁用wifi,你可以使用
def disable_network
%x(adb shell svc wifi disable)
end
def enable_network
%x(adb shell svc wifi enable)
end
在此处找到https://azevedorafaela.wordpress.com/tag/disable-wifi-android-simulator-calabash/ 我自己没试过。
答案 1 :(得分:2)
对于Android设备,我们可以在步骤定义中使用此代码来忘记已连接的Wi-Fi:
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)
端