gpt4 book ai didi

javascript - 如何在 iOS uiautomation 中使用两个按钮处理警报

转载 作者:行者123 更新时间:2023-11-28 02:06:51 27 4
gpt4 key购买 nike

我正在尝试从应用程序注销。当我单击“注销”时,它会显示一个警告框 -> 其中有两个按钮"is"和“取消”,但我无法单击"is"按钮.我尝试了以下代码:

    var log_out = mainWindow.popover().tableViews()[0].cells()["Log out of App"];
log_out.tap();

UIATarget.onAlert = function onAlert(alert){
var name = alert.name();
UIALogger.logMessage("alert "+name+" encountered");
if(name == "App")
{
alert.buttons()["Yes"].tap();
return true;
} else {
return false;
}
}

但是代码甚至没有进入警报函数,因为它没有打印任何消息“警报应用程序遇到”。点击“退出应用程序”按钮后脚本结束。我已经浏览过这些链接 - How to handle an iPhone alert with 2 buttons (want to click the non default button)how to select which button to select in alert message for IOS UIAutomation但似乎不起作用,因为它无法进入警报,因为它没有通过 logMessage 打印任何消息,因此也无法使用坐标方法。

最佳答案

您可以尝试之前定义您的 onAlert 事件。

UIATarget.onAlert = function onAlert(alert){/代码/}

log_out.tap();

关于javascript - 如何在 iOS uiautomation 中使用两个按钮处理警报,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17651049/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com