Instance Method

addUIInterruptionMonitorWithDescription:handler:

Adds a handler to the current context.

Declaration

- (id<NSObject>)addUIInterruptionMonitorWithDescription:(NSString *)handlerDescription handler:(BOOL (^)(XCUIElement *interruptingElement))handler;

Parameters

handlerDescription

An explanation of the behavior and purpose of this handler, mainly used for debugging and analysis.

handler

A handler block for handling asynchronous UI interruptions such as alerts and other dialogs. Handlers should return YES if they handled the UI, NO if they did not. The handler is passed an XCUIElement representing the top level UI element for the alert.

Return Value

Returns a token that can be used to unregister the handler. Handlers are invoked in the reverse order in which they are added until one of the handlers returns true, indicating that it has handled the alert.

See Also

Monitoring UI Interruptions

Handling UI Interruptions

Improve your UI test’s stability by handling interface changes that block the UI elements under test.

- removeUIInterruptionMonitor:

Removes a handler using the token provided when it was added.