Unable to Handle the Download Dialog in IE 9

18 posts, 1 answers
  1. Nitin
    Nitin avatar
    29 posts
    Member since:
    Oct 2010

    Posted 06 Jan 2012 Link to this post

    I am Facing Problems in Handling Download Dialogs in IE 9, I used the Code Snippet below:-



    This Code works in IE 8, but not in IE 9

     

    //Code to Handle the IE Download DialogBox

     

     

    IEDownloadDialog iedownload = new IEDownloadDialog(Manager.ActiveBrowser, DialogButton.OPEN, Manager.Desktop);

     

    //Handles the Dialog Pop-up

     

    Manager.DialogMonitor.AddDialog(iedownload);


    Please help me how to Resolve this problem in IE9 first 
    Also I want solution for All other Browsers (FF, Chrome, Safari)

    Thanks
    Nitin

     

  2. Cody
    Admin
    Cody avatar
    2677 posts
    Member since:
    May 2013

    Posted 06 Jan 2012 Link to this post

    Hi,

    Please try using our DownloadsDialogHandler as shown at the bottom of that page instead. It handles the download dialogs across all browsers.

    Greetings,
    Cody
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

  3. Nitin
    Nitin avatar
    29 posts
    Member since:
    Oct 2010

    Posted 11 Jan 2012 Link to this post

    I wrote the Code for

    //Code to Handle the IE Download DialogBox

     

    IEDownloadDialog iedownload = new IEDownloadDialog(Manager.Current.ActiveBrowser, DialogButton.SAVE, Manager.Current.Desktop);

     

     

    //Handle SaveAs Dialog

     

    SaveAsDialog saveAsDialog = SaveAsDialog.CreateSaveAsDialog(Manager.Current.ActiveBrowser, DialogButton.SAVE, filePath, Manager.Current.Desktop);

     

     

    //Handle DownLoad Complete Dialog

     

     

    IEDownloadCompleteDialog downloadClose = new IEDownloadCompleteDialog(Manager.Current.ActiveBrowser, DialogButton.CLOSE, Manager.Current.Desktop);

     

     

    //Handles the Dialog Pop-up

     

     

    Manager.Current.DialogMonitor.AddDialog(iedownload);

     

     

    //Handles the Dialog Pop-up

     

     

    Manager.Current.DialogMonitor.AddDialog(saveAsDialog);

     

    //Handles the Dialog Pop-up

     

    Manager.Current.DialogMonitor.AddDialog(downloadClose);

     

     

    //Wait for Save Image Button button Exists in DOM

     

     

    //Click on Save Image Button

     Trigger the Action (Click on Save Image Button)

     

    //Handle the IE Dialog

    iedownload.WaitUntilHandled(20000);

     

    //Handle the SaveAs Dialog

    saveAsDialog.WaitUntilHandled(20000);

     

    //Unable to Handle
    downloadClose.WaitUntilHandled(2000);

     

     

     

    try

    {

     

    if (File.Exists(filePath) == true)

    {

     

    Manager.Current.Log.WriteLine("File Exists");

    }

     

    else

    {

     

    throw new FileNotFoundException("File does not Exists", fileName);

    }

    }

     

    finally

    {

     

    // Wait for 2000 milisec

    System.Threading.

     

    Thread.Sleep(2000);

     

    Manager.Current.DialogMonitor.Stop();

     

    // Removing IEDownload Dialog From DialogMonitor

     

    Manager.Current.DialogMonitor.RemoveDialog(iedownload);

     

    // Removing saveAsDialog Dialog From DialogMonitor

     

    Manager.Current.DialogMonitor.RemoveDialog(saveAsDialog);

     

    // Removing downloadClose Dialog From DialogMonitor

     

    Manager.Current.DialogMonitor.RemoveDialog(downloadClose);

     

    // Dispose the Current Manager

     

    //Manager.Current.Dispose();

    In that Case My Download Compelte Dialog is NOT CLOSED in IE 8, I am Stuck where is the Problem

    Please Help, Also the Same Code is NOT EXECUTED on IE 9.0

     

     

  4. Cody
    Admin
    Cody avatar
    2677 posts
    Member since:
    May 2013

    Posted 11 Jan 2012 Link to this post

    Hello,

    First, as I previously stated, please switch to our DownloadDialogsHandler as shown in this code sample:

    //Code to Handle the IE Downloads
    DownloadDialogsHandler DownloadHandler = new DownloadDialogsHandler(Manager.Current.ActiveBrowser, DialogButton.SAVE, filePath, Manager.Current.Desktop);
    Manager.DialogMonitor.Start();
     
    PUT CODE HERE THAT INITIATES THE DOWNLOAD
     
    //Wait until the download is complete
    DownloadHandler.WaitUntilHandled(20000);
    try
    {
        if (File.Exists(filePath) == true)
        {
            Manager.Current.Log.WriteLine("File Exists");
        }
        else
        {
            throw new FileNotFoundException("File does not Exists", fileName);
        }
    }
    finally
    {
        // Wait for 2000 milisec
        System.Threading.
        Thread.Sleep(2000);
        Manager.Current.DialogMonitor.Stop();
    }

    In your code sample I don't see any code that initiates the downloads. You must add code that interacts with your web application to start the download. Usually this means clicking on a button or a link. Please determine what this code should be and place it where I have "PUT CODE HERE THAT INITIATES THE DOWNLOAD". 

    Greetings,
    Cody
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

  5. Nitin
    Nitin avatar
    29 posts
    Member since:
    Oct 2010

    Posted 12 Jan 2012 Link to this post

    Hi Cody

    This solution works while Debugging, but i am getting another error
    I am attaching snapshot

    When I Run that Script, this will not handle the the Download Dialog in IE 9 and Yellow bar appears and nothing hapens

    Thanks
    Nitin

  6. Cody
    Admin
    Cody avatar
    2677 posts
    Member since:
    May 2013

    Posted 12 Jan 2012 Link to this post

    Hello Nitin,

    I have never seen such an error before and have no idea what could be causing it or where it is even coming from. Can you send me a complete test project that reproduces this symptom I can analyze to try and determine what is causing it?

    If you can't send a project that I can run against your website, see if you can reproduce the problem in a new test against this website: http://www.thinkbroadband.com/download.html.

    All the best,
    Cody
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

  7. Nitin
    Nitin avatar
    29 posts
    Member since:
    Oct 2010

    Posted 13 Jan 2012 Link to this post

    Hi Cody

    Attaching the Error.swf as well as my Demo Project.

    Tested against this URL:

    http://demos.telerik.com/aspnet-ajax/fileexplorer/examples/applicationscenarios/filteranddownloadfiles/defaultcs.aspx

    While debugging this Error appears and my File does not get saved.

    Our Application behavior is similar to this.

    Thanks
    Nitin

  8. Nitin
    Nitin avatar
    29 posts
    Member since:
    Oct 2010

    Posted 13 Jan 2012 Link to this post

    Attachments are Here

  9. Nitin
    Nitin avatar
    29 posts
    Member since:
    Oct 2010

    Posted 16 Jan 2012 Link to this post

    Hi Cody

    Is there any way to handle the Download Dilaog in Both IE8 as well as IE9 or we have to write Different Handling Methods for each browsers

    Sometimes IE9 yellow Notification area does not handled Properly

    I am unable to Select Save as from the IE 9 Notofification Area using

    DownloadDialogsHandler DownloadHandler = new DownloadDialogsHandler(Manager.Current.ActiveBrowser, DialogButton.SAVE, filePath, Manager.Current.Desktop);
    Manager.DialogMonitor.Start();
    Sometimes the Code not works and Notification Bar keeps on Blinking with Yellow Colours.

    Thanks 
     

  10. Cody
    Admin
    Cody avatar
    2677 posts
    Member since:
    May 2013

    Posted 16 Jan 2012 Link to this post

    Hi,

    It is supposed to be automatic so that you don't need to worry about it. However we discovered earlier today that our download dialog handling in IE8 is broken. We will get this fixed ASAP. You can track the PITS Issue here.

    Please wait until we come out with a fix for this. Then the same code should work across all browsers, all versions. Also you can see this forum post for a possible temporary work around.

    Kind regards,
    Cody
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

  11. Rohit
    Rohit avatar
    10 posts
    Member since:
    Dec 2011

    Posted 25 Jan 2012 Link to this post

    Hi Cody & Nitin,

    Is there any way to handle the Download Dilaog in Both Chrome 16.0.912.77 m as well as Firefox 9.0.1.

    I am unable  to Save as from the Chrome 16.0.912.77 m as well as Firefox 9.0.1 
    Area using 

    DownloadDialogsHandler DownloadHandler = newDownloadDialogsHandler(Manager.Current.ActiveBrowser, DialogButton.SAVE, filePath, Manager.Current.Desktop);
    Manager.DialogMonitor.Start();

    PUT CODE HERE THAT INITIATES THE DOWNLOAD Like Click Event
     
    //Wait until the download is complete
    DownloadHandler.WaitUntilHandled(20000);

    Its not handle dialog box and not typing the file path as well.

    I am Totally stuck please help out :( :(

    My Scripts are failed while running this code in Chrome 16.0.912.77 m as well as Firefox 9.0.1 

    I am Using Telerik.Testing.Framework.2011.2.1305


    Regards,
    Rohit Malhotra


     


  12. Nitin
    Nitin avatar
    29 posts
    Member since:
    Oct 2010

    Posted 25 Jan 2012 Link to this post

    Hi Cody

    How to Handle Save As Dialog in Cross Browsers using Same Code, as I seen from Rohit's Snapshot he was facing problem in Handling SaveAs Dialogs 
     
    there are different Classes
    DownloadDialogs Handler
    SaveAsDilaog

    Please provide Generic Solution for Handling these as it Supports All Major Browsers, but my Code is Running only in IE

    Thanks


  13. Anthony
    Admin
    Anthony avatar
    19 posts
    Member since:
    Sep 2012

    Posted 25 Jan 2012 Link to this post

    Hello Rohit & Nitin,

    The DownloadDialogsHandler is intended to work in all four browsers. As Cody stated, it currently isn't working in IE8 so you'll need to use his proposed work-around.

    If you're having difficulty with Firefox downloads, ensure you configured according to these instructions.

    When clicking a download link in Safari, it will automatically save the file to the default path you specify in its settings. So, the code below will work in Safari, just not the custom path portion. The file will save to the default location set in Safari. If you'd like to specify a custom path, use the work-around outlined here.

    The following code worked for me in IE9, FF 9.0.1, Safari 5.1.2, and Chrome 16.0.912.63:

    Manager.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;
    Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
     
    string saveLocation = string.Format("address-{0:HH-mm-ss}.xls", DateTime.Now);
    DownloadDialogsHandler handler = new DownloadDialogsHandler(ActiveBrowser, DialogButton.SAVE, @"C:\" + saveLocation, Desktop);
     
    HtmlAnchor dlLink = Find.ByContent<HtmlAnchor>("Sample Address File");
    dlLink.Click();
     
    System.Threading.Thread.Sleep(3000);
    handler.WaitUntilHandled(30000);

    Kind regards,
    Anthony
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

  14. Rohit
    Rohit avatar
    10 posts
    Member since:
    Dec 2011

    Posted 27 Jan 2012 Link to this post

    Hi Anthony,

    Thanks for your quick reply..............

    This code is working well while we trying it your sample application.

    But if application behavior is different this code doesn't works well like my application(I am using SILVER LIGHT Application)

    In my application while click on download link its always take the file save path which used last time (like i used c:\myfolder\rrr.xlx) its always take the same please see screenshot 
     (silverlightdownloadsaveas.png).

    If I changed browser setting then no effect on behavior of the application it behaves the same as shown in screenshot (silverlightdownloadsaveas.png) (browsersetting.png)

    either I checked the ( Ask where to save each file before downloading ) or not its shown me the same window always please see the screenshot (silverlightdownloadsaveas.png) 


    I am totally stuck please provide me specific resolution for that :( :( :(

    Hope this time u'll provide me the resolution even after understand the behavior of my application.

    Thanks

  15. Rohit
    Rohit avatar
    10 posts
    Member since:
    Dec 2011

    Posted 27 Jan 2012 Link to this post

    HI Anthony 

    Could you please schedule a Meeting with Us 

    I am a Licensed User, as you can see from my Profile

    My Location is in India 

    I am facing Problems in Handling Dialogs in Cross Browses(Chrome, FireFox, IE9)

    We have Requirement to Test our Automation Scrpts in ALL Latest Browsers 

    Please Help I am Stuck and Waiting 

    Regads
    Rohit

  16. Answer
    Stoich
    Admin
    Stoich avatar
    1 posts
    Member since:
    Sep 2012

    Posted 31 Jan 2012 Link to this post

    Hi Nitin,
    as a paying customer, you are indeed entitled to a GoToMeeting. I've been assigned to arrange and carry out the GoToMeeting since I'm much closer to your timezone.

    I noticed that you have two accounts both under your name but only one of those is listed as a licensed developer for Test Studio. I would like to ask you to open a Support ticket from the other account so that we may discuss the details of the GoToMeeting in our confidential support ticket system. It's more appropriate than a public forum.

    Regards,
    Stoich
    the Telerik team


    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

  17. Rohit
    Rohit avatar
    10 posts
    Member since:
    Dec 2011

    Posted 31 Jan 2012 Link to this post

    Hi Stoich,

    I am already generated the support ticket for it details are as follows:-

    1. Ticket ID: 506342
    2. Status: Open
    3. Response deadline: 72
    4. Last reply date: 22 hours ago
    5. Type: Support
    6. Product: Test Studio

    Thanks
    Rohit

  18. Nitin
    Nitin avatar
    29 posts
    Member since:
    Oct 2010

    Posted 02 Feb 2012 Link to this post

    Hi Stioch 

    Thank you for Providing Workaround(directly type the Path with Desktop.Keyboard)  for this Issue.

    Regards 
    Nitin



Back to Top