Getting children in a GroupBox

Sep 10, 2008 at 3:39 PM
I have a VB application with several GroupBox on the form.  There are controls (Treeview, combo, textBox) located in the GroupBox as well as other buttons on the form.  Whote does not have a problem seeing the buttons and groupboxes, however, it cannot see the (or at least I can;t figure it out) how to get access to the controls in the groupbox.  I have been able to get the children of the groupbox using AutomationElement just to verify that the application is not using some type of custom wrapper around the controls.  Thissis jsut a quick app I put together so I can see how White sees the controls.

 

The code (console app) prompts for the application, displays a list of windows.  Here is th code tat is doing the processing of the controls:        

                        Console.WriteLine("selected window " + wselect.Name);
                        UIItemCollection itmcol = null;
                        itmcol = wselect.Items;
                        Console.WriteLine("Total items = " + itmcol.Count.ToString());
                        foreach (UIItem itm in itmcol)
                        {
                            Console.WriteLine("\t" + itm + " " + Convert.ToString(itm.Location));
                            //Console.WriteLine("\t" + itm.GetType().ToString());
                            if(itm.GetType().ToString() == "Core.UIItems.GroupBox")
                            {
                                AutomationElement ae = itm.AutomationElement;
                                Condition con = new PropertyCondition(AutomationElement.IsEnabledProperty, true);
                                AutomationElementCollection aec = ae.FindAll(TreeScope.Children, con);
                                Console.WriteLine("\t--contains " + aec.Count.ToString() + " children");
                                if (itm.Name == "Available Templates")
                                {
                                    Console.WriteLine("\t" + aec[0].Current.ClassName.ToString() + " " + aec[0].Current.ControlType.ToString() + " " + aec[0].Current.Name);
                                   
                                }
                            }

                        }

and here is part of the output:
.....
Button with AutomationID=8 and Name=(empty) 405,400
GroupBox with AutomationId=9 and Name=Available Templates 31,188
--contains 1 chiuldren
TreeView20WndClass System.Windows.Automation.COntrolType
......

Is there a way to get the children of a groupbox using white, and how?

 

Coordinator
Sep 13, 2008 at 7:09 AM
I would schedule this to future releases because quite a few people have ask for it.
Although you can use this:
window.ItemsWithin
Sep 24, 2008 at 7:18 PM
Thanks for the reply.  I have been swamped with other tasks and was just able to start looking at this again yesterday....
I have tried that, and a few other things, and not getting much luck.  When I use the ItemsWithin it returns one child item (as expected) however, it thinks it is a DateTimePicker and not the TreeView20WndClass.  When I use UISpy, it only sees the treeview as a pane with a classname of TrewView20WndClass.  When I use the AutomationElement of the GroupBox which contains the treeview, I am able to find the treeview as a child element.  (I have not spent much time using White and much less using UIAutomation.)  So far I have not been able to get any of the contents of the treeview.  Since the control I am looking for was found as an AutomationElement, is there an easy way to it converted to the Win32TreeNode used in White so I can then leverage the functions already created in White?

Coordinator
Sep 28, 2008 at 4:46 PM
Can you window.LogStructure and send the output to me?
Sep 30, 2008 at 6:46 PM
Here is the output from the LogStructure:

[2008-09-30 13:43:28,916][INFO ] Using BusyTimeout=5000 for White/Core
[2008-09-30 13:43:28,932][INFO ] Using WaitBasedOnHourGlass=True for White/Core
[2008-09-30 13:43:28,932][INFO ] Using LogActions=False for White/Core
[2008-09-30 13:43:28,932][INFO ] Using WorkSessionLocation=. for White/Core
[2008-09-30 13:43:28,932][INFO ] Using UIAutomationZeroWindowBugTimeout=5000 for White/Core
[2008-09-30 13:43:28,932][INFO ] Using PopupTimeout=5000 for White/Core
[2008-09-30 13:43:28,932][INFO ] Using TooltipWaitTime=0 for White/Core
[2008-09-30 13:43:28,932][INFO ] Using SuggestionListTimeout=3000 for White/Core
[2008-09-30 13:43:28,932][INFO ] Using DefaultDateFormat=Month,Day,Year for White/Core
[2008-09-30 13:43:28,932][INFO ] Using DragStepCount=1 for White/Core
[2008-09-30 13:43:29,245][INFO ] AutomationId:
ControlType: ControlType.Window
Name:  Print Manager - SMOKE
HelpText:
Bounding rectangle: 144,66,800,608
ClassName: ThunderRT6FormDC
IsOffScreen: False

    AutomationId: 2
    ControlType: ControlType.Group
    Name:
    HelpText:
    Bounding rectangle: 160,173,772,484
    ClassName: ThunderRT6Frame
    IsOffScreen: False

        AutomationId: 34
        ControlType: ControlType.Group
        Name: Current Print Set
        HelpText:
        Bounding rectangle: 569,173,363,477
        ClassName: ThunderRT6Frame
        IsOffScreen: False

            AutomationId: 35
            ControlType: ControlType.Document
            Name:
            HelpText:
            Bounding rectangle: 576,216,349,49
            ClassName: ThunderRT6TextBox
            IsOffScreen: False

                AutomationId: Vertical ScrollBar
                ControlType: ControlType.ScrollBar
                Name: Vertical Scroll Bar
                HelpText:
                Bounding rectangle: 906,218,17,45
                ClassName:
                IsOffScreen: False

                    AutomationId: SmallDecrement
                    ControlType: ControlType.Button
                    Name: Back by small amount
                    HelpText:
                    Bounding rectangle: 906,218,17,17
                    ClassName:
                    IsOffScreen: False

                    AutomationId: SmallIncrement
                    ControlType: ControlType.Button
                    Name: Forward by small amount
                    HelpText:
                    Bounding rectangle: 906,246,17,17
                    ClassName:
                    IsOffScreen: False

            AutomationId: 36
            ControlType: ControlType.Edit
            Name:
            HelpText:
            Bounding rectangle: 576,190,349,19
            ClassName: ThunderRT6TextBox
            IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Pane
            Name:
            HelpText:
            Bounding rectangle: 576,271,349,372
            ClassName: TreeView20WndClass
            IsOffScreen: False

        AutomationId: 3
        ControlType: ControlType.Button
        Name:
        HelpText:
        Bounding rectangle: 534,337,25,25
        ClassName: ThunderRT6CommandButton
        IsOffScreen: False

        AutomationId: 4
        ControlType: ControlType.Button
        Name:
        HelpText:
        Bounding rectangle: 534,288,25,25
        ClassName: ThunderRT6CommandButton
        IsOffScreen: False

        AutomationId: 5
        ControlType: ControlType.Button
        Name:
        HelpText:
        Bounding rectangle: 534,442,25,25
        ClassName: ThunderRT6CommandButton
        IsOffScreen: False

        AutomationId: 6
        ControlType: ControlType.Button
        Name:
        HelpText:
        Bounding rectangle: 534,545,25,25
        ClassName: ThunderRT6CommandButton
        IsOffScreen: False

        AutomationId: 7
        ControlType: ControlType.Button
        Name:
        HelpText:
        Bounding rectangle: 534,497,25,25
        ClassName: ThunderRT6CommandButton
        IsOffScreen: False

        AutomationId: 8
        ControlType: ControlType.Button
        Name:
        HelpText:
        Bounding rectangle: 534,385,25,25
        ClassName: ThunderRT6CommandButton
        IsOffScreen: False

        AutomationId: 9
        ControlType: ControlType.Group
        Name: Available Templates
        HelpText:
        Bounding rectangle: 160,173,363,477
        ClassName: ThunderRT6Frame
        IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Pane
            Name:
            HelpText:
            Bounding rectangle: 167,190,349,454
            ClassName: TreeView20WndClass
            IsOffScreen: False

    AutomationId:
    ControlType: ControlType.Pane
    Name:
    HelpText:
    Bounding rectangle: 148,653,792,17
    ClassName: StatusBar20WndClass
    IsOffScreen: False

    AutomationId:
    ControlType: ControlType.Pane
    Name:
    HelpText:
    Bounding rectangle: 148,116,792,24
    ClassName: Toolbar20WndClass
    IsOffScreen: False

        AutomationId:
        ControlType: ControlType.Pane
        Name:
        HelpText:
        Bounding rectangle: 148,118,792,22
        ClassName: msvb_lib_toolbar
        IsOffScreen: False

    AutomationId:
    ControlType: ControlType.Pane
    Name:
    HelpText:
    Bounding rectangle: 156,148,780,510
    ClassName: TabStrip20WndClass
    IsOffScreen: False

    AutomationId: TitleBar
    ControlType: ControlType.TitleBar
    Name:  Print Manager - SMOKE
    HelpText:
    Bounding rectangle: 148,70,792,26
    ClassName:
    IsOffScreen: False

        AutomationId: SystemMenuBar
        ControlType: ControlType.MenuBar
        Name: System Menu Bar
        HelpText:
        Bounding rectangle: 148,70,18,25
        ClassName:
        IsOffScreen: False

            AutomationId: Item 1
            ControlType: ControlType.MenuItem
            Name: System
            HelpText:
            Bounding rectangle: 148,70,18,25
            ClassName:
            IsOffScreen: False

        AutomationId: Minimize
        ControlType: ControlType.Button
        Name: Minimize
        HelpText:
        Bounding rectangle: 868,70,24,24
        ClassName:
        IsOffScreen: False

        AutomationId: Maximize
        ControlType: ControlType.Button
        Name: Maximize
        HelpText:
        Bounding rectangle: 892,70,24,24
        ClassName:
        IsOffScreen: False

        AutomationId: Close
        ControlType: ControlType.Button
        Name: Close
        HelpText:
        Bounding rectangle: 916,70,24,24
        ClassName:
        IsOffScreen: False

    AutomationId: MenuBar
    ControlType: ControlType.MenuBar
    Name: Application
    HelpText:
    Bounding rectangle: 148,96,792,19
    ClassName:
    IsOffScreen: False

        AutomationId: Item 1
        ControlType: ControlType.MenuItem
        Name: File
        HelpText:
        Bounding rectangle: 148,96,28,19
        ClassName:
        IsOffScreen: False

        AutomationId: Item 2
        ControlType: ControlType.MenuItem
        Name: Edit
        HelpText:
        Bounding rectangle: 176,96,30,19
        ClassName:
        IsOffScreen: False

        AutomationId: Item 3
        ControlType: ControlType.MenuItem
        Name: Help
        HelpText:
        Bounding rectangle: 206,96,33,19
        ClassName:
        IsOffScreen: False

 

Coordinator
Oct 2, 2008 at 11:21 AM
You would have to use CustomUIItem for it because the control type for the tree that you have is Pane instead of Tree (I don't know why).
On the other hand TreeView20WndClass doesn't seem to have any TreeNodes inside it. (do you have treenodes in your application?)