Appium 使用 python+appium,想要调用 adb 命令关闭 wifi,该如何实现?

匿名 · 2017年01月10日 · 最后由 wixed 回复于 2017年01月12日 · 1704 次阅读

想要通过 appium 关闭 wifi 和打开 wifi
目前了解到 adb shell su→svc wifi disable/enable 可以切换。
但是在调用的过程中发现不能成功。
试过用 os.popen os.system 都不成功,怀疑是因为 adb shell su 之后,才能去执行 svc wifi disable
所以之前用两次 os.open 都失败。
后来改用 os.popen("adb shell su&&svc wifi disable")、os.popen('adb shell "su svc wifi disable"') 也不行,求解答

共收到 4 条回复 时间 点赞

这篇文章看看https://testerhome.com/topics/6556
appium 没用过,但是应该可以获取到 context。

Turn on wifi - adb shell am start -n io.appium.settings/.Settings -e wifi on
Turn off WiFi - adb shell am start -n io.appium.settings/.Settings -e wifi off
Turn on mobile data - adb shell am start -n io.appium.settings/.Settings -e data on
Turn off mobile data - adb shell am start -n io.appium.settings/.Settings -e data off

论坛上就有

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册