【发布时间】:2009-01-19 16:21:14
【问题描述】:
我想使用 WatiN 来验证 JavaScript 警告框中的错误消息。这可能吗?谢谢。
【问题讨论】:
标签: watin
我想使用 WatiN 来验证 JavaScript 警告框中的错误消息。这可能吗?谢谢。
【问题讨论】:
标签: watin
参见Trev's Blog 和here。
using(IE ie = new IE("http://hostname/pagename.htm"))
{
AlertDialogHandler alertDialogHandler = new AlertDialogHandler();
using (new UseDialogOnce(ie.DialogWatcher, alertDialogHandler ))
{
/*************************************
* -- alert -- *
* *
* must use the "NoWait" to allow *
* the code to goto the next line *
* *
*************************************/
alertDialogHandler.WaitUntilExists();
alertDialogHandler.OKButton.Click();
ie.WaitForComplete();
}
}
【讨论】: