2011-04-05 104 views
1

我想使用Watin下載PDF文件,但我無法下載文件。我寫了下面的代碼,但它不起作用。 Actual scenario is atteched with image file。 請點擊鏈接。Watin-如何下載pdf文件與IE瀏覽器彈出

IE ie = IE.AttachToIE(Find.ByUrl(「Url here ...」)); - 它給出錯誤。

FileDownloadHandler handler = new FileDownloadHandler(fullFileName); 
using (new UseDialogOnce(ie.DialogWatcher, handler)) 
{ 
    lnkDoc.Click(); 
    try 
    { 
     handler.WaitUntilFileDownloadDialogIsHandled(30); 
     handler.WaitUntilDownloadCompleted(100); 
    } 
    catch 
    { 
    } 
} 
+0

你會得到什麼錯誤? – 2011-04-05 06:22:06

回答

1

您嘗試附加到此新窗口顯示PDF。 WatiN無法附加到這些窗口。

+0

然後測試它的推薦方法是什麼? :-) – 2011-04-18 14:15:21

+0

Aha,http://stackoverflow.com/questions/1191897/how-to-check-if-pdf-was-successfully-opened-in-the-browser-using-watin – 2011-04-18 15:05:30