0

This is my current code, that sometimes fails and that gives me that exception:

An exception of type 'FlaUI.Core.Exceptions.PropertyNotSupportedException' occurred in FlaUI.Core.dll but was not handled in user code. The requested property 'Name [#30005]' is not supported.

public void HandleImportSettingsWindow()
{
    using (var automation = new UIA3Automation())
    {
        var desktop = automation.GetDesktop();

        var window = Retry.WhileNull<Window>(
            () =>
            {
                var windows = desktop.FindAllChildren(cf => cf.ByControlType(ControlType.Window));
                AutomationElement window = null;
                foreach (var w in windows)
                {
                    // TODO: Handle The requested property 'Name [#30005]' is not supported exception.
                    // Sometimes it is possible to have untitled windows that don't have a "Name" property, such as splash screens.

                    // The window title can differ but it always includes the word "Import".
                    if (Regex.Match(w.AsWindow().Title, @"(Import)").Success)
                    {
                        window = w;
                        break;
                    }
                }
                return window.AsWindow();
            },
            timeout: TimeSpan.FromSeconds(10)
        ).Result;

        if (window != null)
        {
            window.SetForeground();
            window.Focus();
            Keyboard.Type(VirtualKeyShort.TAB);
            Thread.Sleep(400);
            Keyboard.Type(VirtualKeyShort.SPACE);
        }
    }
}

Do you have any fix or workaround for this problem?

0lan
  • 179
  • 1
  • 14

0 Answers0