Alex Rivera | Logout

UIAutomation: Any way to dismiss "Would Like To Use Your Current Location" alert?

Asked 2013-03-26T18:59:01.580
10

my app is using location services, and for automated testing, I want to be able to dismiss the "APP Would Like To Use Your Current Location" popup. However, when I try to do this in Instruments with a UIAutomation script, I get this error:

Fail: Could not start script, target application is not frontmost.

This kind of makes sense, because the alert is produced by a different process. But still, what is Apple's plan for helping people automate their tests in this situation?

Edit
Report

1 Answer

1
**Try**

UIATarget.onAlert = function onAlert(alert)
        {
        return true;
        }
alertTitle = target.frontMostApp().alert().name();
if(alertTitle==="APP Would Like To Use Your Current Location")
{
target.frontMostApp().alert().buttons()["OK"].tap();
}
answered 2013-03-29T11:36:57.777

Your Answer