【发布时间】:2015-09-24 13:07:49
【问题描述】:
使用 calabash-android 打开和关闭飞行模式的最佳方法是什么?
我可以使用perform_action('set_preferences', .... ) 吗??
上面的 set_preferences 做了什么?我想在应用程序测试期间设置 android 设置。
谢谢
【问题讨论】:
使用 calabash-android 打开和关闭飞行模式的最佳方法是什么?
我可以使用perform_action('set_preferences', .... ) 吗??
上面的 set_preferences 做了什么?我想在应用程序测试期间设置 android 设置。
谢谢
【问题讨论】:
你的问题有点含糊。是模拟器还是设备?
如果你只需要禁用 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/ 不过我自己没试过。
【讨论】:
对于 Android 设备,我们可以在 Step 定义中使用此代码来忘记已连接的 Wi-Fi:
做
%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)
结束
【讨论】: