简体   繁体   中英

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. The purpose of this application is to learn automation using 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. 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM