[XCUITest] The capabilities 'autoAcceptAlerts' and 'autoDismissAlerts' do not work for XCUITest-based tests. Please adjust your alert handling accordingly

Appium v1.6.4-beta
Xcode 8.2
macOs Sierra 10.12

How to add accept alerts in ios?

I got this when I run in real device.
I want to accept photo library access and notification access.

[XCUITest] The capabilities 'autoAcceptAlerts' and 'autoDismissAlerts' do not work for XCUITest-based tests. 
Please adjust your alert handling accordingly.

I experience this same problem when attempting to detect the Accept Notifications alert from iOS. I am able to tap the “Allow” button but I need to know how to recognize that this or any iOS generated alert is overlaying my app screen. All of my tests are written in JAVA for both my Android and iOS apps.

@duncwa hi,

How did you tap the allow button? My app is in the landscape mode. So I’m unable to tap it. Would you don’t mind to share your script here?

I am not able to recognize that iOS has displayed the system alert. I just knew that after the “enable notifications” button was pressed that the iOS generated message would appear and, only as an experiment, immediately looked for a button named “Allow”. This, of course, is not a valid test, just me experimenting that I could tap the “Allow” button if it appeared. Code: "public MobileElementWrapper enableNotifications() { return new ClickableElement(MobileElement) iosDriver.findElementById( id: “enable notify button”), elementName: “button” + TAG, UserType.ALL_USERS); ".

After the above method executes I look for for an “Allow” button and using ClickableElement. I’m using Java to run tests.

1 Like