WatiN downloading a file from webpage
- by user541597
I have the following code which does a couple of webpage redirections and then clicks an tag which has a javascript fuction as the href. When it is called a file is download. My problem is I want to be able to download the file without being prompted to cancel, save or open. Please help I am using IE9
using (var browser = new IE("http:url.aspx")) {
browser.TextField(Find.ByName("ctl00$ContentPlaceHolder1$Login1$UserName")).TypeText("cpereyra");
browser.TextField(Find.ByName("ctl00$ContentPlaceHolder1$Login1$Password")).TypeText("Maxipereyra15");
browser.Button(Find.ByName("ctl00$ContentPlaceHolder1$Login1$LoginButton")).Click();
browser.GoTo("http://it-motivity-cmc/Movation/MyPage/MyDashboard.aspx?dynamicdashboardid=ab000000-7dea-11c9-b596-d01e04bebb94");
while (browser.Eval("document.readyState") != "complete") {
Thread.Sleep(1000);
}
Div div = browser.Div("ctl00_ContentPlaceHolder1_wrapper_vis_zone1_1");
div.Link(link => link.Text == "Export to CSV").Click();
}