How could I find an application window via it's ClassID?

徘徊边缘 提交于 2020-01-05 08:05:36

问题


I'm using White for test automation. I had created simple application test, which is tracking an application via it's dialog name.

var appCalc = Application.AttachOrLaunch(new ProcessStartInfo("application.exe"));
var wndCalc = appCalc.GetWindow("Dialog caption");

But this approach is unstable, because in different localisations, the caption could differ. How could i track my application, using it's ClassID?


回答1:


    var wndCalc = appCalc.GetWindow(SearchCriteria.ByNativeProperty(AutomationElement.ClassNameProperty, "Your class name"), InitializeOption.NoCache);


来源:https://stackoverflow.com/questions/7802626/how-could-i-find-an-application-window-via-its-classid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!