简体   繁体   中英

Accessing Infragistics UI components with TestStack.White

I have a C# WinForms application using several Infragistics components, including grids, status-bars and so on.

I'm trying to automate the UI testing using TestStack.White: so far, I've been successfully interacting with the regular .net components.

I'm using the Visual UI Automation Verify tool to explore the application and locate/access the required UI components. I need to access the text of the highlighted Hyperlink, within a UltraStatusBar.

在此处输入图片说明

The following is the C# code I use. I can successfully fetch the panel containing the UltraStatuBar from the main window and the status bar itself from that panel, but somehow I could not manage to access the UI components within the UltraStatusBar.

在此处输入图片说明

Any hints?

Have you tried using the UIAComWrapper branch of White? I've found a lot of the Infragistics controls can't be accessed without MS Automation 3.0 (which is what UIAComWrapper wraps).

Looks like you use UIA Verify 2.0 , that shows you what could be seen using UIComWrapper . White uses MS UI Automation without UICom.

Possible solution - try to find controls by native MS UI Automation, if it's Whites issue

var elementsCollection = statusBar.AutomationElement.FindAll(TreeScope.Children, Condition.TrueCondition);
     foreach (AutomationElement element in elementsCollection)
     {
         if (element.Current.AutomationId.Contains("lblFileName"))
         {
             //do what you need
         }
     }

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