I\'m trying to test the presence of an UIAlertView with UIAutomation but my handler never gets called.
At the beginning of my javascript i write :
UI
The below code works for me. The function is handling the alert and "alert Shown" is printed on the logs.
var target = UIATarget.localTarget();
var application = target.frontMostApp();
var window = application.mainWindow();
UIATarget.onAlert = function onAlert(alert){
UIALogger.logMessage("alert Shown");
}
target.frontMostApp().mainWindow().tableViews()[0]
.cells()["Fhgui"].buttons()["Images"].tap();
// Alert detected. Expressions for handling alerts
// should be moved into the UIATarget.onAlert function definition.
target.frontMostApp().alert().defaultButton().tap();