Save a File from a WPF-Application

2 posts, 0 answers
  1. Mostafa
    Mostafa avatar
    22 posts
    Member since:
    Aug 2012

    Posted 22 Aug 2012 Link to this post

    Hi Telerik Team, 

    I am Facing Problems in Handling the Download Dialog in WPF-Application. All the exemples and solutions that i found, are talking about internet explorer & Browsers. I have a WPF-Application and tring to test the Feature: " Save and Load"

    I need to save the state, than to load the state. The state will be save as an XML-File with the extension " xxx.playlist". The test studio can't handle this window dialiog (see figure).

    I have tried to program the save action, but it is not working.

    Here is my code:


    [CodedStep(@"Click Save")]
            public void A022_001_SaveAndLoad_CodedStep2()
                var settings = new Settings();
                settings.Wpf = new ArtOfTest.WebAii.Core.Settings.WpfSettings("\"C:\\Program Files (x86)\\ClipJOCKEY_Nexio\\ClipJOCKEY.exe\"");
                var manager = new Manager(settings);
                var theApp = manager.ActiveApplication;
                SaveAsDialog saveDlg = SaveAsDialog.CreateSaveAsDialog(manager.ActiveApplication, DialogButton.SAVE, "test");
                // LeftClick on Item180Textblock
                Applications.ClipJOCKEYexe.ClipJOCKEY.Item180Textblock.User.Click(ArtOfTest.WebAii.Core.MouseClickType.LeftClick, 17, 25, ArtOfTest.Common.OffsetReference.TopLeftCorner, ArtOfTest.Common.ActionPointUnitType.Percentage, ((System.Windows.Forms.Keys)(0)));



    The object manager.ActiveApplicationis is always in debugging initialized to zero. How can how can I initialize it? is that correct what I'm doing? Do you know the solution?

    greeting and thanks



  2. Plamen
    Plamen avatar
    8 posts

    Posted 27 Aug 2012 Link to this post

    Hello Mostafa,

    When you are using a coded step there is no need to create a new Settings or Manager objects. You can simply use the existing ones. Also, there is no need to start or stop the Dialog Monitor, Test Studio will do that for you. The following code should be enough to handle the Save File dialog with a coded step:
    SaveAsDialog saveDlg = SaveAsDialog.CreateSaveAsDialog(Manager.ActiveApplication, DialogButton.SAVE, "test");

    I have created a simple WPF application with Save File dialog and as you can see in this video. I was able to handle it both ways, via a regular recorded step and via a coded step. I have attached the sample project for your reference.

    If you continue to have difficulty a local repro is necessary. Can you provide a copy of your WPF app, or ask your developers to create a small sample app that demonstrates the issue? If you deem that information too sensitive for a public forum, please attach it a support ticket (which is confidential) and reference this thread.

    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top