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();

posted on 2007-05-22 22:38 WebQ 阅读(625) 评论(7) 编辑 收藏

评论

#1楼 2007-05-23 13:18 匆匆的过客[未注册用户]

能写的详细写么  回复 引用   

#2楼 2007-06-19 23:09 webq[未注册用户]

求救呢:
我今天重装系统不好用了,捕捉不到了,alertDialogHandler.WaitUntilExists()这句总是报错,说找不到dialog,请问有啥建议么?
 回复 引用   

#3楼 2007-06-20 17:09 风生水起      

重装系统是不是系统某个软件换了?我使用WatiN也不是很多,不过我觉得如果分析不出原因可以利用它的源码调试一下。  回复 引用 查看   

#4楼 2007-06-21 13:50 webq

@风生水起
先谢谢您的回复,用这玩意的人太珍稀。
经过无数猜测和试验,均告失败。不知啥原因。后来我把ie的插件全部disable,结果好了。我真想说一句,tnnd!

 回复 引用   

#5楼 2007-09-24 13:05 sdf[未注册用户]

能不能讲一下如何处理弹出IE窗体  回复 引用   

#6楼 2007-09-24 13:08 sdf[未注册用户]

补充一下,是对子窗体的操作  回复 引用   

#7楼 2007-12-19 16:14 December[未注册用户]

根本就不行啊,你在那超的  回复 引用   

导航

公告

昵称:WebQ
园龄:7年8个月
粉丝:1
关注:0

搜索

 
 

常用链接

最新随笔

我的标签

最新评论

推荐排行榜