WPF Action on my dialog not recorded

1 Answer 55 Views
Dialog WPF Testing
eric
Top achievements
Rank 1
eric asked on 07 Jun 2023, 06:37 PM | edited on 07 Jun 2023, 07:33 PM

So im testing out Test Studio and when i try to record a task to displays a file chooser dialog, any actions done in the dialog are not recorded.

We use internally a notification mechanism that handle such dialog requests but in the end it does display a dialog window.

 

I believe that the issue is that the form SaveAs form called in the end is not a WPF dialog but a winform one. However it seems like there is no way to mix the two tests together.

 

I tried to create a Win form test and call it from my WPF test but it wont let me.

 

Is there any way to force the recording in that particular dialog?

 

Also on another question, what if my application opens windows explorer and would like to code some actions to be done in windows explorer. Im not sure i know how i can do that?

Thank you

1 Answer, 1 is accepted

Sort by
0
Ivaylo
Telerik team
answered on 12 Jun 2023, 03:08 PM

Hello Eric,

Thank you for your interest in Test Studio and I am sorry to hear for the troubles you are experiencing. As you already figured it out in a WPF test you are not able to automate WinForms application you should use the Desktop testing feature. For this particular scenario you can use coded approach to automate the dialog. Here is an article on how you can proceed. 

Here is an example: The following dialog cannot be recognized by Test Studio:



However using the Desktop functionality and the following coded example this can be fully automated:

var desktop = DesktopElement.FromDesktopRoot();
var dialog = desktop.Find.ByName("Select Folder");
var editExpression = new DesktopFindExpression("name=Folder:", "className=Edit");
var edit = dialog.Find.ByExpression(editExpression).As<DesktopEdit>();
edit.Text = @"C:\Users\User\Pictures\Camera Roll";
var buttonExpression = new DesktopFindExpression("name=Select Folder", "className=Button");
var selectButton = dialog.Find.ByExpression(buttonExpression).As<DesktopButton>();
selectButton.Press();

You can use similar coded approach for automating windows explorer as well.

Should you have any additional questions please do not hesitate to contact us.

Regards,
Ivaylo
Progress Telerik

Virtual Classroom is the free self-paced technical training portal that gets you up to speed with Telerik and Kendo UI products including Telerik Test Studio! Check it out at https://learn.telerik.com/.
Tags
Dialog WPF Testing
Asked by
eric
Top achievements
Rank 1
Answers by
Ivaylo
Telerik team
Share this question
or