0

我不知道是否有其他人遇到过这个问题,但是当我尝试使用 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")
4

0 回答 0