How to handle complete notification bar in IE9?

2 posts, 0 answers
  1. Dmitry
    Dmitry avatar
    1 posts
    Member since:
    Jul 2013

    Posted 01 Aug 2013 Link to this post

    Hi to all.


    Given: file that needed to be downloaded by clicking on button(btnExportProfile)

    Code: 

    DownloadDialogsHandler part1_0 = new DownloadDialogsHandler(myManager.ActiveBrowser, DialogButton.SAVE, @"C:\", myManager.Desktop);
     
    SaveAsDialog part2_0 = SaveAsDialog.CreateSaveAsDialog(myManager.ActiveBrowser, DialogButton.SAVE, @"", myManager.Desktop);
     
    IE9DownloadCompleteNotificationBar dlComplete1 = new IE9DownloadCompleteNotificationBar(myManager.ActiveBrowser, DialogButton.CLOSE);
                 
    myManager.DialogMonitor.AddDialog(part2_0);
    myManager.DialogMonitor.AddDialog(dlComplete1);
     
    myManager.ActiveBrowser.Find.ById<HtmlControl>("btnExportProfile").Click();
     
    System.Threading.Thread.Sleep(10000);
    part1_0.WaitUntilHandled(40000);
    part2_0.WaitUntilHandled(40000);
    dlComplete1.WaitUntilHandled(50000);

    The problem is: "complete notification" bar is always visible and cannot be closed. Seems  IE9DownloadCompleteNotificationBar does not work correctly.

  2. Velin Koychev
    Admin
    Velin Koychev avatar
    88 posts

    Posted 06 Aug 2013 Link to this post

    Hi Dmitry,

    It would be easier to use our more complete dialog handler class 'DownloadDialogsHandler' which wraps the individual parts into one fully integrated class.  You can read more about handling file download dialogs in this article.
    Here is sample code how you can use it:
    Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
                ActiveBrowser.NavigateTo("http://www.who.int/inf-new/txt.htm");
                string saveLocation = string.Format("address-{0:HH-mm-ss}.xls", DateTime.Now);
                  
                //Create dialogs
                DownloadDialogsHandler dialog = new DownloadDialogsHandler(ActiveBrowser, DialogButton.SAVE, @"C:\" + saveLocation, Manager.Desktop);
                  
                //Clicking on below button ‘Save Dialog’ will open         
                Find.ByTagIndex<HtmlImage>("img", 108).Click();
                //Wait until dialog is handled
                dialog.WaitUntilHandled(30000);

    I hope this helps.
     
    Regards,
    Velin Koychev
    Telerik
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top