This is a migrated thread and some comments may be shown as answers.

Ie download complete dialog unhandled properly.

1 Answer 78 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Amit
Top achievements
Rank 1
Amit asked on 02 Mar 2012, 10:34 AM

Hi,
everybody

I am having a problem while handling IE8 download_complete window.The code I am using is below--

private bool DownloadExportedFile(string diskpath, FrameworkElement downloadButton)
  {
//download dialog handler 
     DownloadDialogsHandler downloadHandler = new DownloadDialogsHandler(Manager.Current.ActiveBrowser, DialogButton.SAVE, diskpath, Manager.Current.Desktop);
     Manager.Current.DialogMonitor.Start();
//trigger download event               
    downloadButton.User.Click();
//invoke handler
    downloadHandler.WaitUntilHandled(80000);
}

The code works fine for a particular file(.xlsx format,size 10.7 KB ) but when i use the same code for a different file(.zip format,size 342 bytes) it works as excepted for the initial download dialog and then for resulting save as dialog but it does not handle the resulting  download complete dialog as it does not click on its close button. As a result this window remains open.I am on windows 7 with ie 8.

1 Answer, 1 is accepted

Sort by
0
Anthony
Telerik team
answered on 05 Mar 2012, 04:29 PM
Hello Amit,

There's a regression for IE8 download dialog handling and you can find the PITS Issue here: Public URL.

As a work-around in the meantime, you can revert to the old style of handling the download in three parts. Instead of using the dialog handler for part three (where the bug is), add code to press the Enter key instead:

Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
  
string saveLocation = string.Format("address-{0:HH-mm-ss}.xls", DateTime.Now);
  
//Create dialogs
IEDownloadDialog part1 = new IEDownloadDialog(ActiveBrowser, DialogButton.SAVE, Manager.Desktop);
SaveAsDialog part2 = SaveAsDialog.CreateSaveAsDialog(ActiveBrowser, DialogButton.SAVE, @"C:\" + saveLocation, Manager.Desktop);
  
//Exclude part 3
//IEDownloadCompleteDialog part3 = new IEDownloadCompleteDialog(ActiveBrowser, DialogButton.CLOSE, Manager.Desktop);
              
//Add each dialog to the monitor
Manager.DialogMonitor.AddDialog(part1);
Manager.DialogMonitor.AddDialog(part2);
//Manager.DialogMonitor.AddDialog(part3);
               
HtmlAnchor dlLink = Find.ByContent<HtmlAnchor>("Sample Address File");
dlLink.Click();
  
part1.WaitUntilHandled(5000);
part2.WaitUntilHandled(5000);
//part3.WaitUntilHandled(5000);
  
//Alternative handling of part 3
System.Threading.Thread.Sleep(5000);
Manager.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Enter);


All the best,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Amit
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Share this question
or