Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/105.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UIAutomation:任何解雇的方式;希望使用您当前的位置“;警觉的?_Ios_Ui Automation_Instruments_Ios Ui Automation - Fatal编程技术网

Ios UIAutomation:任何解雇的方式;希望使用您当前的位置“;警觉的?

Ios UIAutomation:任何解雇的方式;希望使用您当前的位置“;警觉的?,ios,ui-automation,instruments,ios-ui-automation,Ios,Ui Automation,Instruments,Ios Ui Automation,我的应用程序正在使用位置服务,对于自动测试,我希望能够关闭“应用程序希望使用当前位置”弹出窗口。但是,当我尝试在带有UIAutomation脚本的仪器中执行此操作时,会出现以下错误: Fail: Could not start script, target application is not frontmost. 这种警报是有意义的,因为警报是由不同的过程产生的。但是,苹果有什么计划来帮助人们在这种情况下自动化测试?解决方案似乎是使用AppleScript,在足够的延迟后运行,以允许警报出现

我的应用程序正在使用位置服务,对于自动测试,我希望能够关闭“应用程序希望使用当前位置”弹出窗口。但是,当我尝试在带有UIAutomation脚本的仪器中执行此操作时,会出现以下错误:

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

这种警报是有意义的,因为警报是由不同的过程产生的。但是,苹果有什么计划来帮助人们在这种情况下自动化测试?

解决方案似乎是使用AppleScript,在足够的延迟后运行,以允许警报出现。您告诉它单击模拟器窗口中的警报按钮。

在触发位置请求对话框之前使用此代码。请注意应用程序名称周围的特殊引号

**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();
}
UIATarget.onAlert = function onAlert(alert)
{
    if( alert.name()=="“local” Would Like to Use Your Current Location" )
    {
        alert.buttons()["OK"].tap();
    }
    else
    {
        UIALogger.logFail( "Location request dialog expected.");
    }
    return true;
}

你能发布你的解决方案吗?