iPhone 11.5.1 cannot unlock Automation passcode

I have iPhone 12 mini (15.1.1) and PIN is set to secure the device with MDM solution installed.

I unlocked the system lock to run automation, but Appium seems cannot communicate with my iPhone since there is another lock to be unlocked.
Automation lock page is up when I tried to use device for automated testing using Appium.

System lock:


Automation lock:

I set capabilities but they seems doesn’t help unlocking the Automation lock
unlockKey = “69454”
unlockType = “pin”

Error Logs:

09:37:04 E selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65
09:37:04 E xcodebuild error message:
09:37:04 E . Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
09:37:04 E Stacktrace:
09:37:04 E UnknownError: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65
09:37:04 E xcodebuild error message:
09:37:04 E . Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
09:37:04 E at getResponseForW3CError (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:804:9)
09:37:04 E at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:380:37)
09:37:04 E at runNextTicks (node:internal/process/task_queues:61:5)
09:37:04 E at processImmediate (node:internal/timers:437:9)
09:37:04
09:37:04 …/…/…/Library/Python/3.8/lib/python/site-packages/selenium/webdriver/remote/errorhandler.py:247: WebDriverException
09:37:04 ------------------------------ Captured log setup ------------------------------
09:37:04 WARNING urllib3.connectionpool:connectionpool.py:780 Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<urllib3.connection.HTTPConnection object at 0x1064fdc40>: Failed to establish a new connection: [Errno 61] Connection refused’)': /wd/hub/session
09:37:04 =============================== warnings summary ===============================
09:37:04 tests/ios/openchat/openchat_loading_test.py::test_openchat_loading
09:37:04 /Users/user/Library/Python/3.8/lib/python/site-packages/appium/webdriver/webdriver.py:273: DeprecationWarning: desired_capabilities has been deprecated, please pass in an Options object with options kwarg
09:37:04 super().init(

Environments:

  • iPhone 12 mini (15.1.1)
  • Appium-Python-Client v2.1.0
  • Appium server v1.22.1
  • Host machine: macOS Big sur 11.6

user@AD0167xx ~ % appium --version
1.22.1
user@AD0167xx ~ % appium-doctor
info AppiumDoctor Appium Doctor v.1.16.0
info AppiumDoctor ### Diagnostic for necessary dependencies starting ###
info AppiumDoctor :heavy_check_mark: The Node.js binary was found at: /usr/local/bin/node
info AppiumDoctor :heavy_check_mark: Node version is 17.0.1
info AppiumDoctor :heavy_check_mark: Xcode is installed at: /Applications/Xcode.app/Contents/Developer
info AppiumDoctor :heavy_check_mark: Xcode Command Line Tools are installed in: /Applications/Xcode.app/Contents/Developer
info AppiumDoctor :heavy_check_mark: DevToolsSecurity is enabled.
info AppiumDoctor :heavy_check_mark: The Authorization DB is set up properly.
info AppiumDoctor :heavy_check_mark: Carthage was found at: /usr/local/bin/carthage. Installed version is: 0.38.0
info AppiumDoctor :heavy_check_mark: HOME is set to: /Users/user
info AppiumDoctor :heavy_check_mark: ANDROID_HOME is set to: /Users/user/Library/Android/sdk
info AppiumDoctor :heavy_check_mark: JAVA_HOME is set to: /Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home
info AppiumDoctor Checking adb, android, emulator
info AppiumDoctor ‘adb’ is in /Users/user/Library/Android/sdk/platform-tools/adb
info AppiumDoctor ‘android’ is in /Users/user/Library/Android/sdk/tools/android
info AppiumDoctor ‘emulator’ is in /Users/user/Library/Android/sdk/emulator/emulator
info AppiumDoctor :heavy_check_mark: adb, android, emulator exist: /Users/user/Library/Android/sdk
info AppiumDoctor :heavy_check_mark: ‘bin’ subfolder exists under ‘/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home’
info AppiumDoctor ### Diagnostic for necessary dependencies completed, no fix needed. ###
info AppiumDoctor
info AppiumDoctor ### Diagnostic for optional dependencies starting ###
info AppiumDoctor :heavy_check_mark: opencv4nodejs is installed at: /usr/local/lib. Installed version is: 5.6.0
info AppiumDoctor :heavy_check_mark: ffmpeg is installed at: /usr/local/bin/ffmpeg. ffmpeg version 4.4.1 Copyright (c) 2000-2021 the FFmpeg developers
WARN AppiumDoctor :heavy_multiplication_x: mjpeg-consumer cannot be found.
info AppiumDoctor :heavy_check_mark: set-simulator-location is installed
WARN AppiumDoctor :heavy_multiplication_x: idb is not installed
info AppiumDoctor :heavy_check_mark: applesimutils is installed at: /usr/local/bin/applesimutils. Installed versions are: applesimutils 0.9.4
info AppiumDoctor :heavy_check_mark: ios-deploy is installed at: /usr/local/bin/ios-deploy. Installed version is: 1.11.4
WARN AppiumDoctor :heavy_multiplication_x: bundletool.jar cannot be found
WARN AppiumDoctor :heavy_multiplication_x: gst-launch-1.0 and/or gst-inspect-1.0 cannot be found
info AppiumDoctor ### Diagnostic for optional dependencies completed, 4 fixes possible. ###
info AppiumDoctor
info AppiumDoctor ### Optional Manual Fixes ###
info AppiumDoctor The configuration can install optionally. Please do the following manually:
WARN AppiumDoctor ➜ mjpeg-consumer module is required to use MJPEG-over-HTTP features. Please install it with ‘npm i -g mjpeg-consumer’.
WARN AppiumDoctor ➜ Why idb is needed and how to install it: GitHub - appium/appium-idb: idb integration for Appium
WARN AppiumDoctor ➜ bundletool.jar is used to handle Android App Bundle. Please read http://appium.io/docs/en/writing-running-appium/android/android-appbundle/ to install it
WARN AppiumDoctor ➜ gst-launch-1.0 and gst-inspect-1.0 are used to stream the screen of the device under test. Please read https://appium.io/docs/en/writing-running-appium/android/android-screen-streaming/ to install them and for more details
info AppiumDoctor
info AppiumDoctor ###
info AppiumDoctor
info AppiumDoctor Bye! Run appium-doctor again when all manual fixes have been applied!
info AppiumDoctor

Is this new restriction on new iPhone version? Or is there something I am missing?

I don’t have MDM enabled device, so I’m not sure the first one.
But afaik, the next passcode to “Enable UI Automation” is by iOS 15+'s restriction https://github.com/appium/appium/issues/15898 It is not Appium specific, but also general XCTest(UI). UIAutomation can work after the passcode.

Btw, I’ve tested no passcode preference did not require a passcode for XCTest process

1 Like

Thank you for the answer. I just removed MDM to my phone. And it works find now.