The cancel button in the alert is always used to block the application if the onAlert does not return true . By returning true , you are reporting an alert handling mechanism that you will process by clicking the appropriate button to reject the alert.
Change your view callback to look like this:
UIATarget.onAlert = function onAlert(alert) { UIALogger.logMessage("alert Shown"); UIALogger.logMessage(frontApp.alert().name()); UIALogger.logMessage(frontApp.alert().staticTexts()[1].value()); return true;
Conversely, returning false or rejecting the return value fully signals the warning processing mechanism that the cancel button should be pressed.
source share