You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code snippets static void Main(string[] args) { try { Console.WriteLine("开始测试。。。。"); var path = @"C:\CshisNetProgram\Main\MainShellApp.exe"; var app = FlaUI.Core.Application.Launch(path); var automation = new UIA3Automation(); AutomationElement window; window = automation.GetDesktop().FindFirstDescendant(x => x.ByName("系统登录")); if (window == null) { Console.WriteLine("返回了空"); } Console.WriteLine("执行完毕"); Console.ReadKey(); } catch (Exception ex) { Console.WriteLine("错误:" + ex.Message.ToString()); } }
Describe the bug
When the form has not yet appeared, when the FindFirstDescendant statement is executed, null is not returned. Instead, the code seems to terminate execution and no error is prompted. It just cannot continue to run. How to solve this problem?
Screenshots
The text was updated successfully, but these errors were encountered:
@weifan999 Is the application getting stuck? The statement automation.GetDesktop().FindFirstDescendant(x => x.ByName("系统登录")) is possibly taking a really long time to run. Since it seems like you aren't expecting it to find anything, it won't finish executing until it has checked every element in every application that you have open on your desktop.
Code snippets
static void Main(string[] args) { try { Console.WriteLine("开始测试。。。。"); var path = @"C:\CshisNetProgram\Main\MainShellApp.exe"; var app = FlaUI.Core.Application.Launch(path); var automation = new UIA3Automation(); AutomationElement window; window = automation.GetDesktop().FindFirstDescendant(x => x.ByName("系统登录")); if (window == null) { Console.WriteLine("返回了空"); } Console.WriteLine("执行完毕"); Console.ReadKey(); } catch (Exception ex) { Console.WriteLine("错误:" + ex.Message.ToString()); } }
Describe the bug
When the form has not yet appeared, when the FindFirstDescendant statement is executed, null is not returned. Instead, the code seems to terminate execution and no error is prompted. It just cannot continue to run. How to solve this problem?
Screenshots
The text was updated successfully, but these errors were encountered: