我刚刚使用WPF Framework在Visual Studio中创建了一个桌面应用程序,我的应用程序包含许多自定义控件类型。此应用程序的目的是使用TestStack.White学习自动化。
除了自定义控件类型之外,我能够自动执行大部分操作。实际问题是,我无法获取自定义控件中的元素。谷歌搜索时,我发现了类似的东西
CustomUIItem customControl = item as CustomUIItem;
IUIItem[] items = customControl.AsContainer().GetMultiple(SearchCriteria.All);
但对于我的C#代码,customControl.AsContainer()
无效。我不知道是不是因为任何版本依赖。因此,如果有人知道在TestStack.White中使用AsContainer()
和自定义控件类型的方法,请帮忙。
如果我正确理解你的问题,你应该能够做到
CustomUIItem customControl = item as CustomUIItem;
IUIItem[] items = customControl.GetMultiple(SearchCriteria.All);
正如this SO question回答的那样