Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can WatiN download files without requiring focus?

I use WatiN to automate file transfers (EDI transactions) to/from multiple websites, unfortunately FTP or anything more automation-friendly is not an option. For downloads, I use variations of this example:

FileDownloadHandler download = new FileDownloadHandler(fullFilename);
using (new UseDialogOnce(ie.DialogWatcher, download))
{
    lnkFile.ClickNoWait();

    download.WaitUntilFileDownloadDialogIsHandled(15);
    download.WaitUntilDownloadCompleted(150);
}

This works fine, the only problem is that it requires focus. It's not uncommon for there to be dozens of files to download which can take awhile to complete. I run it in a remote session so my machine isn't unusable, but if there's any way to remove the need for focus it'd be convenient.

like image 664
John Straka Avatar asked Apr 01 '11 13:04

John Straka


1 Answers

Instead of Watin, I would use the WebClient class. http://msdn.microsoft.com/en-us/library/system.net.webclient.aspx

Should be able to upload and download files using that class.

like image 166
Andy Avatar answered Oct 24 '22 06:10

Andy