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

Handle 'Download' dialog

15 Answers 481 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 29 Sep 2014, 05:59 AM
I'm using Test Studio v2013.2.1524.0 to record my test case. After the listing is exported to Excel file, test case cannot be carried on. It throws the following error on 'Handle Download dialog' step

'Timed out waiting '25000' msec. for download dialog to be handled.

How can I solve this problem?

By the way, my application is Silverlight application.

Thanks

15 Answers, 1 is accepted

Sort by
0
Matt
Top achievements
Rank 1
answered on 30 Sep 2014, 12:07 AM
I change the step from recorded step to coded step. Also, I put the try..catch to catch the error.
public void ExportListingToExcel_CodedStep()
        {
            try
            {
                string saveLocation = @"C:\Telerik Automated Test\ExportedDocs\ExportedExcel.xls";   
                DownloadDialogsHandler handler = new DownloadDialogsHandler(ActiveBrowser, DialogButton.SAVE, saveLocation, Manager.Desktop);
                handler.WaitUntilHandled(25000);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

But, ArtofTestRunner crashes after listing is exported to Excel doc. Any ideas?

0
Cody
Telerik team
answered on 02 Oct 2014, 04:41 AM
Hello Matt,

Which browser are you using for testing? If IE, please make sure that "Notify me when downloads are complete" is checked as shown in the attached screen shot.

Regards,
Cody
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Matt
Top achievements
Rank 1
answered on 02 Oct 2014, 04:51 AM
I'm using IE11. Also, "Notify me when downloads are complete" option is turned ON. But, ArtofTestRunner still crashes
0
Cody
Telerik team
answered on 06 Oct 2014, 05:35 PM
Hello Matt,

But, ArtofTestRunner still crashes

Now I am confused, is the runner application crashing or are you simply getting an error reported by the test "Timed out waiting '25000' msec. for download dialog to be handled"? These are two radically different symptoms with radically different causes.

I'm going to assume you just getting the error reported, not an application crash.

When the download completes in your application, do you get a notification like what is shown in the attached screen shot? If not you'll need to implement the SaveAs dialog handler in code as documented here.

Regards,
Cody
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Matt
Top achievements
Rank 1
answered on 06 Oct 2014, 11:05 PM
Even I turned on 'Notify me when downloads are complete' in IE 11

"'Timed out waiting '25000' msec for download dialog to be handled" error is thrown (refer my first post) after listing is exported to excel If I use Test Studio to add/create the Handle Download dialog step, 


ArtifTestRunner crashes after listing is exported to excel if I changed the 'Handle Download dialog' into coded step and used try...catch (refer to my second post). 

Thanks


0
Cody
Telerik team
answered on 07 Oct 2014, 10:37 PM
Hi Matt,

When you manually download the file using your application, do you get a Download Complete like that shown in the attached screen shot? If not you'll need to implement the SaveAs dialog handler in code as documented here.

Regards,
Cody
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Matt
Top achievements
Rank 1
answered on 07 Oct 2014, 11:34 PM
What Telerik library do I need to import or use for SaveAsDialog Handler? I did try to implement the SaveAs dialog handler in code. But, the only handler I can find is DownloadDialogsHandler.

The following are the library I'm using:

using Telerik.TestingFramework.Controls.KendoUI;
using Telerik.WebAii.Controls.Html;
using Telerik.WebAii.Controls.Xaml;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.IO;

using ArtOfTest.Common.UnitTesting;
using ArtOfTest.WebAii.Core;
using ArtOfTest.WebAii.Controls.HtmlControls;
using ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts;
using ArtOfTest.WebAii.Design;
using ArtOfTest.WebAii.Design.Execution;
using ArtOfTest.WebAii.ObjectModel;
using ArtOfTest.WebAii.Silverlight;
using ArtOfTest.WebAii.Silverlight.UI;
using ArtOfTest.WebAii.Win32;
using ArtOfTest.WebAii.Win32.Dialogs;

Thanks
0
Cody
Telerik team
answered on 08 Oct 2014, 08:46 PM
Hello Matt,

You need:

using ArtOfTest.WebAii.Win32.Dialogs;
 
Which it looks like you already have. The class is contained in ArtOfTest.WebAii.dll, which you should already have referenced. Here's sample code how to use it:

SaveAsDialog dlg = SaveAsDialog.CreateSaveAsDialog(ActiveBrowser, DialogButton.SAVE, "c:\path\file.ext", Manager.Desktop);
 
// Steps to initiaate the download go here
 
dlg.WaitUntilHandled(30000);


Regards,
Cody
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Matt
Top achievements
Rank 1
answered on 10 Oct 2014, 02:24 AM
Hello

After I changed my codes to use SaveAsDialog, file location cannot be typed in automatically. Please find the attached SaveAs dialog box screenshot. This is the dialog box we use in our application.

        [CodedStep(@"New Coded Step")]
        public void ExportListingToExcel_CodedStep()
        {
            string saveLocation = @"C:\Telerik Automated Test\ExportedDocs\ExportedExcel.xls"; 
            SaveAsDialog dlg = SaveAsDialog.CreateSaveAsDialog(ActiveBrowser, DialogButton.SAVE, saveLocation, Manager.Desktop);
            dlg.WaitUntilHandled(30000);

        }


Thanks
0
Cody
Telerik team
answered on 13 Oct 2014, 12:21 AM
Hello Matt,

You missed a critical part of the sequence of events. You must call SaveAsDialog.CreateSaveAsDialog before the dialog is present. Then do the action in the application which causes the dialog to open (click the Export/Save button/link or whatever it is) and finally follow that up with dlg.WaitUntilHandled.

This sequence is required because the dialog handler is only monitoring and looking for new dialogs to be created after the dialog handler object has been instantiated. It will ignore dialogs that are already open when you call SaveAsDialog.CreateSaveAsDialog.

Regards,
Cody
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Matt
Top achievements
Rank 1
answered on 13 Oct 2014, 02:02 AM
File location cannot entered automatically in the second SaveAs form. In my test case, I have 2 separate steps to the export the listing to Excel and Word.

No problem on export the listing into Excel - file location can be entered automatically. But, file location cannot be entered on exporting the listing to Word.

I also tried to merge two exports steps into 1 coded step and use the same handler. Still have the same issue.
But if I put export to Word and Excel into 2 different Test Case, they are running fine. Any idea?

[CodedStep(@"ExportListingToWord_CodedStep")]
public void ExportListingToWord_CodedStep()
{
    try
    {
        string wordLocation = @"C:\Telerik Automated Test\ExportedDocs\ExportedWord.doc";
        SaveAsDialog wordhandler = SaveAsDialog.CreateSaveAsDialog(ActiveBrowser, DialogButton.SAVE, wordLocation, Manager.Desktop);
        Manager.DialogMonitor.AddDialog(wordhandler);
 
        //Code triggers the dialog
        Pages.MEX.SilverlightApp.RMCWord.User.Click(ArtOfTest.WebAii.Core.MouseClickType.LeftClick, 24, 55, ArtOfTest.Common.OffsetReference.TopLeftCorner, ArtOfTest.Common.ActionPointUnitType.Percentage, ((System.Windows.Forms.Keys)(0)));
 
        wordhandler.WaitUntilHandled(30000);
        Manager.DialogMonitor.Stop();
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.ToString());
    }
}

Thanks
0
Accepted
Cody
Telerik team
answered on 15 Oct 2014, 06:13 PM
Hello Matt,

I'm pretty sure the call to:

Manager.DialogMonitor.Stop();

Is causing this problem. Stopping the dialog monitor is permanent and will stop Test Studio from handling any dialogs from that point forward. Please remove that line of code.

If that doesn't help try adding this:

wordhandler.CurrentState = DialogCurrentState.NotActive;
 
Place it right after:

wordhandler.WaitUntilHandled(30000);
 


Regards,
Cody
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Victor
Top achievements
Rank 1
answered on 02 Sep 2015, 02:25 AM

Hello Telerik Team,

 I used following Code to save the downloaded to a specific path location as a child test

 Dim FilePath AS String = "D:\Automation Scripts\REGRESSION SUTIE\Download Files\"
 Dim FileName As String = Data("DownloadFileName")
 Dim SaveLocation As String = FilePath + FileName

    Log.WriteLine (SaveLocation)
    
Dim handler As SaveAsDialog = SaveAsDialog.CreateSaveAsDialog(ActiveBrowser, DialogButton.SAVE, SaveLocation, Manager.Desktop)
Manager.DialogMonitor.AddDialog(handler)
handler.WaitUntilHandled(30000)
handler.CurrentState = DialogCurrentState.NotActive

 

Test studio compiles it with no error, but i find strange my parent Test which is using this child Test passes. 

Issue is 

1. Save As dialog box opens but the path specified is not written on to the dialog.

2. Test step passes but action doesn't happen

3. View log displays the following for that particular child test.

     pls refer to the attached log file.

Kindly help to solve the situation
​

 

0
Victor
Top achievements
Rank 1
answered on 02 Sep 2015, 02:27 AM
Attaching files
0
Boyan Boev
Telerik team
answered on 04 Sep 2015, 01:21 PM
Hi Matt,

Please try adding this code 

Manager.DialogMonitor.Start()

after Manager.DialogMonitor.AddDialog(handler):

Let me know if that helps.

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Matt
Top achievements
Rank 1
Answers by
Matt
Top achievements
Rank 1
Cody
Telerik team
Victor
Top achievements
Rank 1
Boyan Boev
Telerik team
Share this question
or