How to support Save Dialog

6 posts, 0 answers
  1. Dafna
    Dafna avatar
    1 posts
    Member since:
    Apr 2013

    Posted 30 Apr 2013 Link to this post

    Hi,

    My application is a WPF application.
    I need to test an export of a file and save it on the computer.
    How can I support the Save Dialog in order to save taht file?

    Thanks
    Dafna
  2. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 30 Apr 2013 Link to this post

    Hello Dafna,

    Here's a sample code you can use to handle the Save File dialog:
    SaveAsDialog saveDlg = SaveAsDialog.CreateSaveAsDialog(Manager.ActiveApplication, DialogButton.SAVE, @"c:\test");
    Manager.DialogMonitor.AddDialog(saveDlg);
    Manager.DialogMonitor.Start();
     
    //Enter the code that triggers the dialog here...
     
    saveDlg.WaitUntilHandled(30000);
    Manager.DialogMonitor.Stop();

    See this short video demonstrating the execution of the code above against a sample WPF application that I just created. Please give it a try and let me know if you need further assistance on this. 

    Kind regards,
    Plamen
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. Valentijn
    Valentijn avatar
    21 posts
    Member since:
    Sep 2010

    Posted 29 Oct 2013 Link to this post

    I have a couple of remarks and questions on this one for Silverlight. First of all I haven't found any documentation that explains or gives an example on how to use the CreateSaveAsDialog method except from the API reference, which I find very unsufficient. Is there any place else this is described? Is there a best practice on how to use it?

    I haven't been able to get this feature to work stable on any browser yet. In IE8 it even seems to work about 20% of the times I tried it. It seems like a very buggy feature.

    Then if you look at the contextual help you provide with the method, visual studio lists the second parameter as the 'dismissButton' and states that the possible options are OPEN and CANCEL. Clearly everbody in their right minds would need a SAVE dialogbutton here...

                var dialog = SaveAsDialog.CreateSaveAsDialog(Manager.ActiveBrowser, DialogButton.SAVE, fileName, Manager.Desktop);

    I don't see any option on how to get more information on getting this fixed. The dialog appears sometimes (in Chrome always) and the filename does not get filled in, finally the WaitUntilHandled call times out. And without any explanation at all to why this happens. Jeez...


                var dialog = SaveAsDialog.CreateSaveAsDialog(Manager.ActiveBrowser, DialogButton.SAVE, fileName, Manager.Desktop);
                Manager.DialogMonitor.AddDialog(dialog);
                Manager.DialogMonitor.Start();
        toolbarItemButton.User.Click(typeOfMouseClick);
        if (ReferenceEquals(dialog, null)) return;
                dialog.WaitUntilHandled(5000);

    Sorry for my tone, but this has been frustrating!
  4. Velin Koychev
    Admin
    Velin Koychev avatar
    88 posts

    Posted 01 Nov 2013 Link to this post

    Hello Valentijn,

    Thank you for your feedback. I was able to reproduce the issue you are describing against our demo website. I filed  a bug report  on this problem with your feedback, which you can follow in our Feedback Portal. I am sorry for any inconvenience it has probably caused and I have also updated your Telerik Points to your account for having been first to report it. I am sure that our developers will be able to fix this problem quickly. The only workaround I can currently find is to record this step with Test Studio.

    You can find more information and code samples how to handle dialogs in this article
    We also appreciate feedback on where our documentation is lacking or needs improvement so we can make the needed corrections and additions. 

    Thank you for your understanding. 

    Regards,
    Velin Koychev
    Telerik
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  5. Graham
    Graham avatar
    1 posts
    Member since:
    Sep 2013

    Posted 06 Nov 2013 Link to this post

    This has also been broken in the latest version of TestStudio. I've just upgraded from 2012.2.1220.0  to  2013.1.911.0 and the following code, that was previously working fine, now no longer functions -

    SaveAsDialog dialog = SaveAsDialog.CreateSaveAsDialog(manager.ActiveBrowser, DialogButton.SAVE, filePath, manager.Desktop);
    manager.DialogMonitor.AddDialog(dialog);
     
    pages.RedBoxRecorderID1.FrameQMFramePlugin.SilverlightApp.SaveRadbutton.User.Click();
    dialog.WaitUntilHandled(20000);
    manager.DialogMonitor.RemoveDialog(dialog);

    Previously the value of filePath was inserted into the dialog which then closed. Now this doesn't happen and the dialog sits there - it doesn't even time out.
  6. Velin Koychev
    Admin
    Velin Koychev avatar
    88 posts

    Posted 11 Nov 2013 Link to this post

    Hi Graham,

    Thank you for reporting this problem. I can see from the code that you have sent us that this is the same problem that Valentijn reported which you can follow in our Feedback Portal.

    Did you try to record the same step using Test Studio or manually add a handle download dialog step? The recorded step should resolve this problem.  

    Let  me know if 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