iOS UITests Error kAXErrorAPIDisabled

Hi,

I found problem when my app run UITests using Xcode 12 beta 12A6159.
It always give this error
Failed to get matching snapshot: Error getting main window kAXErrorAPIDisabled

I tried to po app.otherElements or app.collectionViews but always give me empty result.

Here is my code snippet:
Code Block
let app = XCUIApplication()
app.launch()
let homeCollection = app.collectionViews.firstMatch
homeCollection.waitForExistence(timeout: 10)
measure(metrics: [XCTOSSignpostMetric.scrollDecelerationMetric]) {
homeCollection.swipeUp(velocity: .fast)
}


  • Hi ! Did you manage to fix properly this issue? My understanding is that this is related to system requiring authorization to control app using accessibility.

    I managed to tick "System Preferences > Universal Access > Enable access for assistive devices"

    But what needs to be updated for this option? System Preferences > Security & Privacy > Privacy > Accessibility

    I'm having the issue again after Monterey migration and system is not prompting me for authorization. Any idea on what needs to be done to get that?

Add a Comment