This is a migrated thread and some comments may be shown as answers.

Coded Steps for Folder Browser Dialog

1 Answer 223 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nathan
Top achievements
Rank 1
Nathan asked on 27 Nov 2013, 04:58 PM
We are trying to select a folder path within a dialog from a coded step for a WPF application.  The dialog is generated from the following code:
System.Windows.Forms.FolderBrowserDialog dlg = new System.Windows.Forms.FolderBrowserDialog();
dlg.ShowNewFolderButton = false;
dlg.SelectedPath = GetDefaultDirectory();
dlg.ShowDialog()

Any help would be appreciated!

1 Answer, 1 is accepted

Sort by
0
Rodney
Telerik team
answered on 02 Dec 2013, 08:25 PM
Hello Nathan, 

Try using the following code to open the file dialog and navigate to your target folder. The code navigated to the specified file location and handled the dialog in our demo app. If code doesn't fit your exact scenario or if you have additional questions, please provide a copy of a demo app for us to test against. 

ArtOfTest.WebAii.Win32.Dialogs.OpenFileDialog ofd = ArtOfTest.WebAii.Win32.Dialogs.OpenFileDialog.CreateOpenFileDialog(ActiveApplication, ArtOfTest.WebAii.Win32.Dialogs.DialogButton.OPEN, @"c:\test");
Manager.DialogMonitor.AddDialog(ofd);
  
//Replace with your click step to launch dialog
app.FindName<Button>("myBtn").User.Click()
 
ofd.WaitUntilHandled(10000);
Manager.DialogMonitor.RemoveDialog(ofd);


Let me know if this helps. 


Regards,
Rodney
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Nathan
Top achievements
Rank 1
Answers by
Rodney
Telerik team
Share this question
or