javascript - How to handle alert with two buttons in iOS uiautomation -


i trying signout application.it gives me alert box when click on 'logout' -> has 2 buttons 'yes' , 'cancel' unable click on 'yes' button.i tried following code :

    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;           }       } 

but code doesn't go inside alert function because not printing message 'alert app encountered'. script ends after tapping on 'log out of app' button. have gone through these links - how handle iphone alert 2 buttons (want click non default button) , how select button select in alert message ios uiautomation doesn't seem working because unable go inside alert since not printing message through logmessage not able use coordinates method also.

you can try define onalert event before.

uiatarget.onalert = function onalert(alert){ /code/}

log_out.tap();


Comments