Handling Alert with UIAutomation

前端 未结 7 1549
日久生厌
日久生厌 2020-12-31 07:14

I\'m trying to test the presence of an UIAlertView with UIAutomation but my handler never gets called.

At the beginning of my javascript i write :

UI         


        
7条回答
  •  情话喂你
    2020-12-31 07:15

    @vdaubry the solution is simple.

    According to Apple documentation, if you want to handle alerts manually then you should return true instead of false in onAlert(alert)

     UIATarget.onAlert = function onAlert(alert) {
        UIALogger.logMessage("alertShown");
        return true;
    }
    

    @Drew Crawford the delays will not work because by default can button is clicked by UI Automation. The documentation is not wrong but it is not clearly explained.

提交回复
热议问题