0
我想使用Teststack White和System.Windows.Automation在c#中自动化.NET WinForm应用程序。获取列表中所有打开的MDI窗口
有一次在MdiClient
下有几个打开的窗口,我想获得在MdiClient下打开的所有子窗口的列表。
我尝试:
var window = application.GetWindows().Find(obj => obj.Title.StartsWith("Helios Green"));
window.Focus(DisplayState.Maximized);
AutomationElementCollection allChildren =
window.AutomationElement.FindAll(TreeScope.Children,
new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Window));
但这返回空集,因为MdiChlidren Windows是不是直接在主窗口的孩子,但有一个MDICLIENT类名= WindowsForms10.MDICLIENT.app.0.33c0d9d
之间,如在检查。
如何获取所有打开的MDI子窗口的列表?