WebDriverAgent constantly requests password to enable UI Automation on macOS Monterey

I updated my machine to:

  • macOS Monterey Version 12.4
  • Xcode Version 13.4 (13F17a)
  • iOS Version 15.4.1 (19E258) device real (iPhone 11)
  • iOS Version 15.5 (19F77) device real (iPhone 11)

I executed this command on host machine which is wirelessly connected to X code.

$ automationmodetool enable-automationmode-without-authentication
Setting up machine to allow Automation Mode without requiring user authentication... succeeded.
$ automationmodetool
Automation Mode is disabled.
This device DOES NOT REQUIRE user authentication to enable Automation Mode.

but I still get this exception Underlying Error: Timed out while enabling automation mode.

My devices constantly requests password to enable UI Automation.

Replies

Hello!

The unlock prompt to start UI automation was added as an extra layer of security, to prevent potential attackers from accessing private user data on a device without their consent.

One workaround for the workflow you describe would be to remove the passcode on your device, which does open up its vulnerability from a security perspective, but also removes the need to enter the passcode roughly once per day.

There is no officially supported way to automate the entry of a passcode if you have one, as this would negate the benefits of the added security layer.

Note that passcode entry is not required to test simulated devices, accessed locally or via Xcode Cloud.