How to find the UI view of this system alert?

155 Views Asked by At

Xcode 8.2 KIF testing

I want to automate a drawing app which require permission to save photo to the library.

This is the alert I want to accept

With KIF I gave

  [tester tapViewWithAccessibilityLabel:@"OK"];

But it says, failed to find accessibility element. As a solution I try to use

 [tester tapAccessibilityElement:@"OK" inView:(UIView *)];

How can I find the UIView of this system alert? Are there any other ways to tap this element?

1

There are 1 best solutions below

0
Brian Nickel On

Permissions alerts are out-of-process, meaning KIF can't find them by searching through the views in the app.

There's a special function [tester acknowledgeSystemAlert] that taps "OK" on these alerts.