
if doesn't work try to increase sleep interval or write your own waitUntill methodĪutomationElementCollection dialogElements = AutomationElement.FromHandle(windowDialog.Hwnd).FindAll(TreeScope.Children, Condition.TrueCondition) Window windowDialog = new Window(NativeMethods.GetWindow(windowMain.Hwnd, 5)) TreeWalker dialogElementTreeWalker = new TreeWalker(Condition.TrueCondition) ĪutomationElement mainWindow = dialogElementTreeWalker.GetParent(AutomationElement.FromHandle(browser.hWnd)) Window windowMain = new Window(NativeMethods.GetWindow(browser.hWnd, 5)) Public static void DownloadIeFile(this IE browser,string saveAsFilename=null) Public static class BrowserExtensionMethods
#Free download manager ie9 code
I cleaned up the code a bit that was posted there and this was the resulting file: using System I followed Borris Pavlov's link which did a good job showing the way. The accepted answer did not work for me because IE 9 pops up a "Notification" you have to navigate before you can get to the actual Save As dialog (and WatiN cannot handle notifications automatically). Ie.Link("startDownloadLinkId").ClickNoWait() So I'm assuming the following code works (which is taken from the link to SourceForge in my last comment, notice the ClickNoWait): using(IE ie = new IE(someUrlToGoTo)) Ie.AddDialogHandler(fileDownloadHandler) įileDownloadHandler.WaitUntilFileDownloadDialogIsHandled(15) įileDownloadHandler.WaitUntilDownloadCompleted(200) Īfter the comments below, this answer was accepted. It should be something like: using(IE ie = new IE(someUrlToGoTo))įileDownloadHandler fileDownloadHandler = new FileDownloadHandler(fullFileName) The release notes for that version aren't online anymore ( ), but I found it in Googles cache ( ) This should be supported since version 1. using (var browser = new IE(sLogin))īrowser.AddDialogHandler(new OKDialogHandler()) īrowser.AddDialogHandler(new DialogHandlerHelper()) īrowser.AddDialogHandler(new ConfirmDialogHandler()) īrowser.AddDialogHandler(new ReturnDialogHandlerIe9()) īrowser.TextField(Find.ByName("txtUserID")).TypeText("username") īrowser.TextField(Find.ByName("txtPassword")).TypeText("password") īrowser.Button(Find.ByName("btnLogin")).Click() īrowser.SelectList("ctl00_phFormContent_ucOptionParam0_lst").SelectByValue("4") īrowser.Button(Find.ByName("ctl00$phFormButtonBar$btnRun")).Click() I've tried running it through WatinTestRecorder and that doesn't prompt for saving. Even if it passed 'Alt+S' to the page, that would save it. I'd appreciate any suggestions as I can't see any way of downloading a file, or getting it to save the file.
#Free download manager ie9 download
However, when the download has completed, the IE9 download box appears, and nothing happens, until Watin timesout.

I've managed to get Watin to log into the website, navigate to the appropriate page, change parameters on the page, and click the button to start the download. I'm using the most recent build of Watin (v2.1). The website has a Java button, that when clicked, triggers the download of an Excel file. I'm having an issue with automating the process of downloading a file from a website.
