Forum Discussion
3 Replies
Sort By
- Hi Ruel,There is no such a property. I suggest using the following procedure to determine whether there is a modal WPF dialog:1. Get the main window object.2. Get the window object of the dialog you want to check.3. Try to activate the main window.4. Find out whether the OnUnexpectedWindow event is raised.To determine whether this event has been raised, follow the steps below:1. Set a global project variable (see the 'Project and Project Suite Variables - Overview' help topic).2. Set your own handler for the OnUnexpectedWindow event. It should be like this:function GeneralEvents_OnUnexpectedWindow(Sender, Window, LogParams){Project.Variables.Var1 = true;}Here is a script example. It works with the Orders.exe sample application:[JScript]function checkModal(mainWindow){Project.Variables.Var1 = false;mainWindow.Activate();if (Project.Variables.Var1)Log.Message("Modal");elseLog.Message("Modeless");}function Test1(){var orders, grid, listView;var testedWnd, mainWnd;TestedApps.Orders.Run();orders = Sys.Process("Orders");mainWnd = orders.WPFObject("HwndSource: MainForm");grid = orders.WPFObject("HwndSource: MainForm").MainForm.WPFObject("gridMain");grid.MainMenu.WPFMenu.Click("Orders|Edit order...");testedWnd = orders.Window("#32770", "Warning");checkModal(mainWnd);TestedApps.CloseAll();}
- cruzaderContributorThanks for info.
It actually worked with my scripts.
Additional question related to this...
When executing this code, an item is placed in the log of TestComplete
and it is treated as an error (with error icon). Is there a way not
to included it in the log of TestComplete so that the test will not be
treated as Failed?
Thanks again!
Hi Ruel,
Use the modified event handler below:function GeneralEvents_OnUnexpectedWindow(Sender, Window, LogParams)
{
LogParams.Locked = true;
Project.Variables.Var1 = true;
}
See the 'LogParams Object' help topic for more information.
Related Content
- 9 years agokandy1984
- 5 years agoAl2
- 7 months agoStevenS
- 3 years agosandeep7972
Recent Discussions
- 17 hours agojstaehlin
- 2 days agoAivanitskiy