Can I read JavaScript alert box with WatiN?
问题 I want to use WatiN to verify the error message in a JavaScript alert box. Is this possible? Thanks. 回答1: see Trev's Blog and here as well. 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 * * * ***********************************