Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

who can help me? #626

Open
weifan999 opened this issue Apr 15, 2024 · 1 comment
Open

who can help me? #626

weifan999 opened this issue Apr 15, 2024 · 1 comment

Comments

@weifan999
Copy link

weifan999 commented Apr 15, 2024

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
QQ截图20240415163536

QQ截图20240415163420

@louislefevre
Copy link

louislefevre commented Apr 29, 2024

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants