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

File download/dialog not handling properly

6 Answers 134 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Pam
Top achievements
Rank 1
Pam asked on 22 Aug 2011, 06:13 PM
I am attempting to automate an export scenario. our web app has a trigger that launches a second browser that triggers the download dialog. 
I have used the 3 part method of handling IE8 dialogs (saveAsDialog, IEDownloadDialog, and IEDownloadCompleteDialog) and had it working about 1/2 dozen times. And then it stopped working. I tried changing the code to use just the DownloadDialogsHandler method. Same results. 
Nothing in this area of our app has changed to make this stop working. 

What I see happening is that when the download is triggered a second IE8 browser pops, (then the download dialog is suppose to appear) however, the browser that pops is closed before the dialog gets a chance to appear. 

If someone could see where I went wrong, or has an idea as to why the thing isn't working anymore I would appreciate it.

the simpler method of using the DownloadDialogsHandler (that I've not seen work at all) was used as
DownloadDialogsHandler exportDownload = new DownloadDialogsHandler(Manager.ActiveBrowser, DialogButton.SAVE, fileSave, Desktop);
 
Manager.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;
Manager.DialogMonitor.Start();
 
HtmlControl exportSelectCSV = new HtmlControl(Find.ByAttributes("class=~SiteExportLink"));
exportSelectCSV.Click();
 
exportDownload .WaitUntilHandled();
the code I've used (and saw working a few times) is as follows 
if (File.Exists(fileSave + "export.csv"))
            
{
                File.Delete(fileSave + "export.csv");
            }
 
            SaveAsDialog saveExport = new SaveAsDialog(ActiveBrowser, DialogButton.SAVE, fileSave + "export.csv", Desktop);
            Manager.DialogMonitor.AddDialog(saveExport);
            IEDownloadDialog ieDialog = new IEDownloadDialog(ActiveBrowser, DialogButton.SAVE, Desktop);
            Manager.DialogMonitor.AddDialog(ieDialog);
            IEDownloadCompleteDialog dlComplete = new IEDownloadCompleteDialog(ActiveBrowser, DialogButton.CLOSE, Desktop);
            Manager.DialogMonitor.AddDialog(dlComplete);
             
            Manager.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;
            Manager.DialogMonitor.Start();
 
            HtmlControl exportSelectCSV = new HtmlControl(Find.ByAttributes("class=~SiteExportLink"));
            exportSelectCSV.Click();
 
            ieDialog.WaitUntilHandled();
            saveExport.WaitUntilHandled();
            dlComplete.WaitUntilHandled();

6 Answers, 1 is accepted

Sort by
0
Pam
Top achievements
Rank 1
answered on 24 Aug 2011, 03:05 PM
Does anyone have any ideas?
0
Cody
Telerik team
answered on 25 Aug 2011, 04:36 PM
Hi Pam,

I apologize for the delay responding to you.

A common problem to download file issues is that the "Close this dialog box..." is left checked (see attached screen shot). Our download dialog handling relies on this being unchecked so that we have the chance to recognize the download is complete and then we'll close that last dialog in the chain.

The only way to uncheck this is to manually download something (anything will do) and uncheck it during the download. IE will remember its last setting and keep it there.

All the best,
Cody
the Telerik team
Vote for Telerik Test Studio at the Annual Automation Honors Voting!
0
Pam
Top achievements
Rank 1
answered on 25 Aug 2011, 05:11 PM
this is not the issue. I've verified that the checkbox for automatic dialog closure is not checked.
I have a feeling that the problem may lie in the fact that our download triggers a new browser window that then spawns the download dialog chain.
0
Cody
Telerik team
answered on 26 Aug 2011, 05:50 PM
Hello Pam,

I'm not sure if the extra window is the problem. Microsoft downloads exhibit the same behavior. Can you try the attached test and let me know your results? It runs just fine here.

All the best,
Cody
the Telerik team
Vote for Telerik Test Studio at the Annual Automation Honors Voting!
0
Pam
Top achievements
Rank 1
answered on 18 Oct 2011, 09:34 PM
so sorry for not responding, a dev went in and surpressed the ghost browser window that was popping.
now download dialogs handle fine.
0
Cody
Telerik team
answered on 19 Oct 2011, 03:38 PM
Hi Pam,

We are glad you found a solution to your dialog handling problem.  If there anything else we can help you with we'll be glad to investigate.

All the best,
Cody
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
Pam
Top achievements
Rank 1
Answers by
Pam
Top achievements
Rank 1
Cody
Telerik team
Share this question
or