11
我想使用WatiN來驗證JavaScript警告框中的錯誤消息。這可能嗎?謝謝。可以使用WatiN閱讀JavaScript警告框嗎?
我想使用WatiN來驗證JavaScript警告框中的錯誤消息。這可能嗎?謝謝。可以使用WatiN閱讀JavaScript警告框嗎?
參見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();
}
}
我的歉意 - 我沒有仔細閱讀這個第一次,並沒有認爲它回答了我的問題,但它做到了!謝謝! – Leslie 2009-02-09 12:00:32