我想使用 WatiN 来验证 JavaScript 警报框中的错误消息。这可能吗?谢谢。
see 特雷夫的博客 http://tmichealson.blogspot.com/2007/01/handling-alerts-in-watin.html and here http://tmichealson.blogspot.com/2007/03/use-once-dialog.html以及。
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();
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)