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

How to handle a dialog in Telerik Test Studio? (Error)

3 Answers 202 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 09 Jun 2014, 01:41 PM
I am trying to record steps in Telerik Test Studio for a .NET application. A dialog with an OK button is created like so:

    DialogMessage dialog = new GalaSoft.MvvmLight.Messaging.DialogMessage("Successfully Saved", p => { });
                                dialog.Caption = "My Object Save Results";
                                dialog.Button = MessageBoxButton.OK;
                                dialog.Icon = MessageBoxImage.Information;
                                Messenger.Default.Send(dialog);

I can record myself clicking OK. But when the test runs again, it fails to handle the dialog properly, even if I try different things like hitting Enter, clicking the Close button, modifying the wait time values did not work either. Is this type of dialog not supported? I can't do an image compare test either because the dialog will not highlight as part of the DOM.

    Timed out waiting '5000' msec. for any dialog to be handled '1'
    InnerException:
    System.TimeoutException: Timed out waiting '5000' msec. for any dialog to be handled '1'
       at ArtOfTest.WebAii.Win32.Dialogs.BaseDialog.WaitUntilAnyHandled(IEnumerable`1    dialogs, Int32 handleCount, Int64 timeoutMilliseconds, Boolean resetHandleCount)
       at ArtOfTest.WebAii.Design.IntrinsicTranslators.Descriptors.DialogHandlerDescriptor.Execute(Browser browser)
       at ArtOfTest.WebAii.Design.IntrinsicTranslators.Descriptors.DialogHandlerDescriptor.Execute(IAutomationHost browser)
       at ArtOfTest.WebAii.Design.Execution.ExecutionEngine.ExecuteStep(Int32 order)

3 Answers, 1 is accepted

Sort by
0
Boyan Boev
Telerik team
answered on 12 Jun 2014, 10:12 AM
Hi Eric,

Please try out this code:

var dialog = ConfirmDialog.CreateConfirmDialog(ActiveBrowser, DialogButton.OK);
            Manager.DialogMonitor.AddDialog(dialog);
            Manager.DialogMonitor.Start();
            
Find.ByAttributes<HtmlAnchor>("title=Remove Table").Click();//Replace this row with the correct one which triggers the dialog
            
dialog.WaitUntilHandled();
            Manager.DialogMonitor.Stop();

Hope this helps.

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Sebastian
Top achievements
Rank 1
answered on 16 Jul 2014, 01:18 PM
Check what attributes are being used to detect the button.
You may need to change how the element is detected.
I have very good luck using ID and TagName to find buttons and many other elements.
0
Boyan Boev
Telerik team
answered on 17 Jul 2014, 07:50 AM
Hi Sebastien,

You are absolutely right. Using a static ID to find the elements is the most reliable way to find an element.

Thank you for you input.

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Eric
Top achievements
Rank 1
Answers by
Boyan Boev
Telerik team
Sebastian
Top achievements
Rank 1
Share this question
or