如何通过其ClassID查找应用程序窗口? [英] How could I find an application window via it's ClassID?
本文介绍了如何通过其ClassID查找应用程序窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 White 进行测试自动化.我已经创建了简单的应用程序测试,该测试通过对话框的对话框名称来跟踪应用程序.
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");
但是这种方法是不稳定的,因为在不同的地区,字幕可能会有所不同.我如何使用它的ClassID跟踪我的应用程序?
But this approach is unstable, because in different localisations, the caption could differ. How could i track my application, using it's ClassID?
推荐答案
var wndCalc = appCalc.GetWindow(SearchCriteria.ByNativeProperty(AutomationElement.ClassNameProperty, "Your class name"), InitializeOption.NoCache);
这篇关于如何通过其ClassID查找应用程序窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文