Mobile: installCertificate is not working as expected on iOS 17.2.1

Problem: After the profile is downloaded, all automation steps to dismiss the “Profile Downloaded” alert, install the profile, and trusting the certificate are not executed.

I’m using the appium version 2.5.1 and [email protected]. I’ve also tried with appium 2.0.0 and xcuitest 4.31.0.

If I turn on trust for the certificate, the app can be launched as expected. Any ideas what might be the issue here? Thank you.

Some code snippets:

capabilities.apply {
    setCapability(MobileCapabilityType.AUTOMATION_NAME, XCUITEST)
    setCapability(MobileCapabilityType.APP, APP_PATH)
    setCapability(PLATFORM_NAME, PLATFORM)
    setCapability(PLATFORM_VERSION, base.PLATFORM_VERSION)

    if (IS_REAL_IOS_DEVICE) {
        setCapability(MobileCapabilityType.UDID, base.UDID)
        setCapability("appium:showXcodeLog", true)
        setCapability("appium:fullReset", false)
        setCapability("updatedWDABundleId", "com.fabiosantos.WebDriverAgentLib")
        setCapability("appium:usePrebuiltWDA", true)
        setCapability("appium:wdaStartupRetryInterval", 1000)
        setCapability("appium:wdaStartupRetries", 2)

—

fun installCertificate() {
    val args: MutableMap<String, Any> = HashMap()
    var byteContent = ByteArray(1000)
    try {
        byteContent = Files.readAllBytes(File("cert.pem").toPath())
    } catch (e: Exception) {
        println(e)
    }
    args["content"] = Base64.getEncoder().encodeToString(byteContent)
    iosDriver.executeScript("mobile: installCertificate", args)
}

LOGS

[debug] [XCUITestDriver@4310 (e190c492)] Executing command 'execute'

[debug] [XCUITest] Executing /Users/Santos/Library/Python/3.9/bin/pyidevice profiles install --path /var/folders/mp/94pm95057gqggclrpjpsjt3w0000gq/T/2024119-18381-k0dd98.cgly/cert.pem --udid 00008110-001C283026D1801E --network --format json

[debug] [XCUITest] Command output: {

[debug] [XCUITest] "Status": "Acknowledged"

[debug] [XCUITest] }

[debug] [XCUITest]

[debug] [XCUITestDriver@4310 (e190c492)] Responding to client with driver.execute() result: null

[HTTP] <-- POST /session/e190c492-f528-4db5-b1e2-97fe8ead2e7b/execute/sync 200 460 ms - 14

[HTTP] [XCUITestDriver@4310 (e190c492)] Shutting down because we waited 60 seconds for a command