Ios UIAutomation Instrument Exception“;目标应用程序不是最前面的“应用程序”;
我有一个iOS5 iPad应用程序,它使用Ios UIAutomation Instrument Exception“;目标应用程序不是最前面的“应用程序”;,ios,ios-simulator,instruments,cllocationmanager,ios-ui-automation,Ios,Ios Simulator,Instruments,Cllocationmanager,Ios Ui Automation,我有一个iOS5 iPad应用程序,它使用CLLocationManager,我正在用UIAutomation进行测试 在运行测试脚本之前,我手动按下iOS在使用CLLocationManager时显示的对话框上的“OK” 有时,我的测试脚本将无法启动。我在仪器中按下“播放”图标,12秒钟内什么也没发生。然后,我得到以下异常: Target app is not frontmost 一旦发生这种情况,我通常必须重新启动才能使仪器再次工作 当我离开应用程序前面的CLLocationManager
CLLocationManager
,我正在用UIAutomation
进行测试
在运行测试脚本之前,我手动按下iOS在使用CLLocationManager时显示的对话框上的“OK”
有时,我的测试脚本将无法启动。我在仪器
中按下“播放”图标,12秒钟内什么也没发生。然后,我得到以下异常:
Target app is not frontmost
一旦发生这种情况,我通常必须重新启动才能使仪器再次工作
当我离开应用程序前面的
CLLocationManager
对话框时,我也会遇到同样的异常。有人知道如何解决这个问题吗?当应用程序完全启动前弹出警报视图时,就会发生这种情况。这是一个自动化错误。处理警报要删除此错误,请参阅自动化用户界面\u使用\u仪器测试\u pdf
//Handling Externally Generated Alerts
UIATarget.onAlert = function onAlert(alert) {
var title = alert.name();
UIALogger.logWarning("Alert with title ’" + title + "’ encountered!");
if (title == "Add Something") {
alert.buttons()["Add"].tap();
return true; // bypass default handler
}
return false; // use default handler
}
Use this code to handle location alert