Question

Im thinking of using White for my simple windos ui automation. First i run external application from my application using System.Diagnostics.Process. When the external application opens is going to give me a dialog where the user has insert some text and click OK button. What i need is to wait until the dialog is closed or detect the OK button is clicked. All i need is some indication that user is finished with that dialog and i can go on with my automation tasks.

Is there any way doing this with White? Any other options also welcome!

Was it helpful?

Solution

You can setup a title on that dialog, and schedule a timer to find a child window among Main window's children. If it's not found, you can proceed. Should work.

OTHER TIPS

Another way:

using System.Windows.Automation;

Automation.AddAutomationEventHandler(
            WindowPattern.WindowClosedEvent,
            AutomationElement.RootElement, // set correct value here
            TreeScope.Children,            // check the value is correct
            (sender, e) =>
            {
                var element = sender as AutomationElement;
                if (element.Current.Name != "Form Title")
                    return;

                Automation.RemoveAllEventHandlers(); // remove event handler

                // Your code here
                // CodeToRunAfterWindowClosed();
            });
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top