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?
**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();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With