8 Answers, 1 is accepted
Here's a sample code you can use to handle the Save File dialog:
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.
the Telerik team
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...
if (ReferenceEquals(dialog, null)) return;
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.
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.
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.
Its broken again in latest build 2019.3.1412.0. Here is my code snippet
public ActionOutput RegisterDownloadDialog(RegisterDownloadDialogAction action)
var downloadPath = Path.Combine(AutomationContext.Current.TestRunSettings.StorageLocation, "TestRuns", AutomationContext.Current.TestRun.TestRunId.ToString(), "Downloads");
var targetFile = Path.Combine(downloadPath, action.FileName);
if (AutomationContext.Current.Manager.ActiveBrowser.Manager != AutomationContext.Current.Manager)
throw new Exception("do not match");
AutomationContext.Current.Manager.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;
var dialog = SaveAsDialog.CreateSaveAsDialog(AutomationContext.Current.Manager.ActiveBrowser, DialogButton.SAVE, targetFile, AutomationContext.Current.Manager.Desktop);
//var dialog = new DownloadDialogsHandler(AutomationContext.Current.Manager.ActiveBrowser, DialogButton.SAVE, targetFile, AutomationContext.Current.Manager.Desktop);
I am sorry to hear that the dialog handling is not working as expected.
Based on the provided code snippet, I see that you have defined the download dialog correctly with the DownloadDialogsHandler(). In addition to that, you need to start the DialogMonitor, which should the register the dialogs that appear on the page. I am not sure if this happens somewhere else in your code and how it is structured, but I have a sample code that might help you.
The DownloadDialogHandler should be initialized and the DialogMonitor should be started, before you call the Click action. Otherwise the dialog will not be added in list of dialogs in time and that will cause a failure. Please adjust the sample code to match your test scenario and try it again.
In case the issue persists, please share a sample project, against a publicly accessible application, that I can run and troubleshoot. I will try to help you find the best approach to handle such dialogs.
Thank you for your cooperation.