Handling Alert with UIAutomation

前端 未结 7 1561
日久生厌
日久生厌 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:38

    e.g. - onAlert is not called

    var target = UIATarget.localTarget(); 
    target.buttons()["ShowAlert"].tap()
    UIAtarget.onAlert = function onAlert(alert)
    {...}
    

    -

    e.g. - onAlert is called

    var target = UIATarget.localTarget(); 
    UIAtarget.onAlert = function onAlert(alert)
    {......}
    target.buttons()["ShowAlert"].tap()
    

    or

    #import "onAlert.js"
    var target = UIATarget.localTarget(); 
    target.buttons()["ShowAlert"].tap()
    

    Try it out.

提交回复
热议问题