2009-01-19 41 views

回答

13

參見Trev's Bloghere

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(); 
    } 
} 
+1

我的歉意 - 我沒有仔細閱讀這個第一次,並沒有認爲它回答了我的問題,但它做到了!謝謝! – Leslie 2009-02-09 12:00:32