我看過這三個職位:取消按鈕被竊聽時不採取任何措施
UIAutomation : Cancel button on Alert view is tapped without actually doing it
UIATarget.onAlert = function onAlert(alert) Issue - Script doesn't seem to go into block correctly
,我知道這個問題可以修復。我試圖使用人們在帖子中提出的方法,但它並不適合我。我想再次問這裏...
所以我需要在警報窗口上輸入密碼。就像這樣:
target.frontMostApp().keyboard().typeString("1234");
我想知道我是否應該先寫onAlert功能,並把此行的代碼onAlert功能之後?或者先寫入onAlert函數,然後將這一行代碼放入onAlert函數中?
我試圖做這樣的事情:
UIATarget.onAlert = function onAlert(alert)
{
return true;
target.frontMostApp().keyboard().typeString("1234");
}
但它不工作...按鈕仍然被點擊的取消...謝謝!