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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With