解决XCUItest Enable UI Automation每次启动需要输入锁屏密码
自从服务器更新版本后,每次执行 iOS UI自动化测试都需要锁屏密码
- macOS Monterey Version 12.0.1
- Xcode Version 13.1 (13A1030d)
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-88jQHgff-1646278780476)(/uploads/photo/2022/e0a7adff-79a4-4bbb-82af-3037443f9425.png!large)]
解决办法
若不解决该问题,将没有办法做到持续测试。于是不断翻阅官方文档,找到解决方案
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.