webq

Handle alert dialog with WatiN

      Useful objects of WatiN are DialogHandlers.We can use one of them : AlertDialogHandler to handle a window.alert dialog.
However the WatiN Recoder still generate correct codes about such a scenario so far(But I always think WatiN Recoder is a very graet tool).
Let\'s look the completely correct  codes as follows:
1WatiN.Core.IE ie = new IE();
2ie.GoTo("http://localhost/approval");
3AlertDialogHandler alertDialogHandler = new AlertDialogHandler();
4ie.AddDialogHandler(alertDialogHandler);
5ie.Button(Find.ById("BtnSubmit")).ClickNoWait();
6alertDialogHandler.WaitUntilExists();
7alertDialogHandler.OKButton.Click();
8ie.WaitForComplete();

分类:

技术点:

相关文章: