1UIATarget.onAlert = function onAlert(alert){ 2 3 UIALogger.logMessage("In Alert!"); 4 title = alert.name(); 5 if (title && title.indexOf("Microphone") !== -1) { 6 UIALogger.logMessage("Alert with title '" + title + "' encountered!"); 7 var buttons = alert.buttons(); 8 var buttonCount = buttons.length; 9 10 if (buttonCount > 0) { 11 var acceptButton = buttons[buttonCount - 1]; 12 acceptButton.tap(); // last button is accept 13 } 14 return true; //forbid the default cancel processing 15 } 16 return false; //using the default cancel processing 17} 18var target = UIATarget.localTarget(); 19target.delay(6000); 20