[英]Is there a way to get all the elements inside a Custom Control type in TestStack.White
我刚刚使用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);
正如这个问题的答案
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.