iOS 测试 解决 XCUItest Enable UI Automation 每次启动需要输入锁屏密码

异彩飞天 · 2022年03月03日 · 1920 次阅读

解决 XCUItest Enable UI Automation 每次启动需要输入锁屏密码

自从服务器更新版本后,每次执行 iOS UI 自动化测试都需要锁屏密码

  • macOS Monterey Version 12.0.1
  • Xcode Version 13.1 (13A1030d)

解决办法

若不解决该问题,将没有办法做到持续测试。于是不断翻阅官方文档,找到解决方案

xcodebuild -target MemoryLeaksUITests -scheme MemoryLeaks test
The automationmodetool command line tool allows you to manage UI automation security preferences, see its man page for details. To resolve your issue, run the following command as a administrator on your machine: 
       automationmodetool enable-automationmode-without-authentication

To disable this mode, run the following command as a administrator on your machine: 
     automationmodetool disable-automationmode-without-authentication

Note that the man page shows leading dash in front of each of the above two commands, it is a bug. Please disregard it and use the commands as described above. 
暫無回覆。
需要 登录 後方可回應,如果你還沒有帳號按這裡 注册