我不知道是否有其他人遇到此问题,但当我尝试使用AndroidViewClient / Monkeyrunner点击“保持清醒”和“允许模拟位置”选项的复选框时,它们不会在导航离开开发者选项设置或离开设置应用。这是我用来访问它们的代码:
def enable_developer_setting(vc, name):
setting = vc.findViewWithTextOrRaise(name).getParent().getParent()
if not setting.children[len(setting.children) - 1].children[0].isChecked():
print(name + " not enabled...enabling")
setting.touch()
enable_developer_setting(vc, "Stay awake")
enable_developer_setting(vc, "USB debugging")
enable_developer_setting(vc, "Allow mock locations")