[英]Is there a way to get all the elements inside a Custom Control type in TestStack.White
I just created a desktop application in Visual Studio using WPF Framework, and my application contains a lot of custom control types. 我刚刚使用WPF Framework在Visual Studio中创建了一个桌面应用程序,并且我的应用程序包含许多自定义控件类型。 The purpose of this application is to learn automation using TestStack.White.
该应用程序的目的是学习使用TestStack.White的自动化。
Most of this I am able to automate except the custom control type. 除了自定义控件类型之外,我大多数都能自动化。 The actual issue is, I am not able to get the elements inside the custom control.
实际的问题是,我无法在自定义控件中获取元素。 While Googling, I found something like
在谷歌搜索时,我发现了类似
CustomUIItem customControl = item as CustomUIItem;
IUIItem[] items = customControl.AsContainer().GetMultiple(SearchCriteria.All);
but for my C# code, customControl.AsContainer()
is not working. 但是对于我的C#代码,
customControl.AsContainer()
无法正常工作。 I don't know if it is because of any version dependency. 我不知道是否是因为任何版本依赖性。 So if anyone knows a way to use
AsContainer()
with custom control types in TestStack.White, please help. 因此,如果有人知道在TestStack.White
AsContainer()
与自定义控件类型一起使用的方法,请提供帮助。
If I'm understanding your Question correctly, you should be able to just do 如果我正确理解了您的问题,那么您应该可以
CustomUIItem customControl = item as CustomUIItem;
IUIItem[] items = customControl.GetMultiple(SearchCriteria.All);
as this SO question answered 正如这个问题的答案
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.