ios – UIAutomation:任何方式来解雇“想使用您当前的位置”提醒?

我的应用程序正在使用位置服务,而对于自动测试,我想要能够解除“APP想要使用当前位置”弹出窗口.但是,当我尝试使用UIAutomation脚本在Instruments中执行此操作时,我会收到此错误
Fail: Could not start script,target application is not frontmost.

这样做是有道理的,因为警报是由不同的过程产生的.但是,在这种情况下,苹果计划如何帮助人们自动化测试?

解决方法

**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();
}

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...