Recently I wanted to automatically trigger and extract some backup files from a web application. Their smug support guy told me this wasn't possible, so I started to throw together a little scraper to prove them wrong.
WebClient classes. Given that the built-in Web Browser control is a pile of shit, I installed the Awesomium SDK which turned out to be very pleasant to work with. You can just inject your own JS which gives you a lot of flexibility.
I ran across an issue when triggering the actual download of my backup file. A download file dialog displays by default, which is less than ideal. The documentation doesn't do a great job of explaining how to override this behavior, so here's a quick overview of what I did in VB.NET:
Pop this in with your import statements:
Add an event handler:
AddHandler WebCore.Download, AddressOf SkipDLPath
And then put something like this in your handler method:
Private Sub SkipDLPath(sender As Object, e As DownloadEventArgs) Dim DLPath as String = "C:\Backups\myBackup.zip" e.Handled = True e.SelectedFile = DLPath End Sub
The file chooser prompt should be suppressed and Awesomium will happily start downloading the file. I monitored the progress and completion using the