TreeView

Jul 28, 2008 at 5:01 PM
Does White support TreeViews? I saw ListView and TreeItems.Tree but neither of them work for me. Specifically, I want to be able to select rows in a TreeView.
Jul 29, 2008 at 8:26 AM
This code may do the trick, wwContainer would be the control holding the TreeView Control:

using Core.UIItems.TreeItems;

Tree tvTreeView = null;
TreeNode tnNode = null;

tvTreeView = wwContainer.Get<Tree>("TreeView Name");

tnNode = tvTreeView .Nodes.GetItem("Node Name");
tnNode .Select();
tnNode .Click();
Jul 29, 2008 at 4:00 PM
Edited Jul 29, 2008 at 4:01 PM
Thanks for the suggestion, it didn't work though. I did a window.Get<TreeItems.Tree>(SearchCriteria.All) and got a null back. I take it that means there exists no Trees within the entire window?  I can do window.Get(SearchCriteria.ByAutomationId("TreeView Name")) and it returns a TableHeader object. Not really sure what I can do with that, or how I could use that to get the rows within the TreeView.
Jul 30, 2008 at 8:56 AM
You should use then a tool like snoop (http://blois.us/Snoop/) to found out if you got a tree and which is its automation id which you will use as the name to locate it.
if the result of using window.Get(SearchCriteria.ByAutomationId("Whatever name has your TreeView")) returns you a TableHeader then make sure you are passing the correct name to the function, or check through snoop that both controls are not named the same.
Coordinator
Jul 31, 2008 at 3:28 AM
If you are not using WPF please try out UISpy. Do let me know what you find?
Jul 31, 2008 at 2:29 PM
It is a WPF app and I've used both UISpy and Snoop to inspect the visual tree. UISpy reveals my TreeView as a ControlType.Custom, and I can see the Buttons, Thumbs and ScrollBars within it, but nothing that would allow me to select a row itself. Snoop of course shows a lot more detail. To get to a row from the root of my TreeView it goes ContentPresenter -> Xceed.Wpf.DataGrid.DataGridControl -> Grid -> DockPanel -> ItemsPresenter -> Xceed.Wpf.DataGrid.DataRow. So I'm thinking because it's an Xceed control, maybe White won't be able to get to the row level. Could I do it using an AutomationElement query?
Aug 1, 2008 at 8:55 AM
Ok so this is your answer, ain't a standard tree what you got there even if it looks and behaves like one, so your main concern now is to find the type of control of a node and his owner container and see if White can capture that control type.
Coordinator
Aug 4, 2008 at 4:16 AM
Can you please send me the output of window.LogStructure()?
Aug 14, 2008 at 7:55 AM
Edited Aug 14, 2008 at 7:57 AM

Hi

   I do have problems in getting access to a WPF Tree. I am not able to get the parent or child node or neither access through nodes inside a tree view.I get null for the tree node which is mentioned below. Can you plz help me out on this.

Tree tree = window.Get<Tree>("treeSampleOutline"); 
T
hread.Sleep(250); 
TreeNode treenode = tree.Node("MY TESTING TREE");


This is the Output of   window.LogStructure()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

           AutomationId: listOverModules
            ControlType: ControlType.List
            Name:
            HelpText:
            Bounding rectangle: -1,290,167,24
            ClassName: ListBox
            IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Menu
            Name:
            HelpText:
            Bounding rectangle: 165,291,10,10
            ClassName: Menu
            IsOffScreen: False

                AutomationId: menuOverflowMenu
                ControlType: ControlType.MenuItem
                Name: »
                HelpText:
                Bounding rectangle: 160,289,19,16
                ClassName: MenuItem
                IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Menu
            Name:
            HelpText:
            Bounding rectangle: 165,301,10,10
            ClassName: Menu
            IsOffScreen: False

                AutomationId:
                ControlType: ControlType.MenuItem
                Name: v
                HelpText:
                Bounding rectangle: 161,298,16,16
                ClassName: MenuItem
                IsOffScreen: False

        AutomationId:
        ControlType: ControlType.Thumb
        Name:
        HelpText:
        Bounding rectangle: 0,311,175,5
        ClassName: GridSplitter
        IsOffScreen: False

        AutomationId: ctlFavouriteList
        ControlType: ControlType.Custom
        Name:
        HelpText:
        Bounding rectangle: 0,316,175,250
        ClassName: FavouriteList
        IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Text
            Name: My Favourites
            HelpText:
            Bounding rectangle: 1,317,77,16
            ClassName: TextBlock
            IsOffScreen: False

            AutomationId: btnAction
            ControlType: ControlType.Button
            Name: Add
            HelpText:
            Bounding rectangle: 151,317,23,16
            ClassName: Button
            IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Pane
            Name:
            HelpText:
            Bounding rectangle: 0,336,175,230
            ClassName: ScrollViewer
            IsOffScreen: False

                AutomationId: VerticalScrollBar
                ControlType: ControlType.ScrollBar
                Name:
                HelpText:
                Bounding rectangle: 0,336,0,0
                ClassName: ScrollBar
                IsOffScreen: True

                AutomationId: HorizontalScrollBar
                ControlType: ControlType.ScrollBar
                Name:
                HelpText:
                Bounding rectangle: 0,336,0,0
                ClassName: ScrollBar
                IsOffScreen: True

        AutomationId: ctlHistoryList
        ControlType: ControlType.Custom
        Name:
        HelpText:
        Bounding rectangle: 0,566,175,249
        ClassName: HistoryList
        IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Text
            Name: My History
            HelpText:
            Bounding rectangle: 1,567,59,16
            ClassName: TextBlock
            IsOffScreen: False

            AutomationId: btnAction
            ControlType: ControlType.Button
            Name: Clear All
            HelpText:
            Bounding rectangle: 128,567,46,16
            ClassName: Button
            IsOffScreen: False

            AutomationId: tvwItems
            ControlType: ControlType.Tree
            Name:
            HelpText:
            Bounding rectangle: 0,586,175,229
            ClassName: TreeView
            IsOffScreen: False

                AutomationId:
                ControlType: ControlType.TreeItem
                Name: MS.Internal.Data.CollectionViewGroupInternal
                HelpText:
                Bounding rectangle: 1,587,173,16
                ClassName: TreeViewItem
                IsOffScreen: False

                    AutomationId: Expander
                    ControlType: ControlType.Button
                    Name:
                    HelpText:
                    Bounding rectangle: 1,588,19,13
                    ClassName: Button
                    IsOffScreen: False

                    AutomationId:
                    ControlType: ControlType.Image
                    Name:
                    HelpText:
                    Bounding rectangle: 21,587,16,16
                    ClassName: Image
                    IsOffScreen: False

        AutomationId:
        ControlType: ControlType.Thumb
        Name:
        HelpText:
        Bounding rectangle: 175,47,5,768
        ClassName: GridSplitter
        IsOffScreen: False

        AutomationId: ctlExpander
        ControlType: ControlType.Button
        Name:
        HelpText:
        Bounding rectangle: 172,411,10,40
        ClassName: Button
        IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Text
            Name: -
            HelpText:
            Bounding rectangle: 175,424,4,14
            ClassName: Text
            IsOffScreen: False

 


 

Coordinator
Aug 15, 2008 at 8:24 PM
Tree tree = window.Get<Tree>("treeSampleOutline"); 
T
hread.Sleep(250); 
TreeNode treenode = tree.Node("MY TESTING TREE");

I think you are using the wrong automation id. you should be doing this
Tree tree = window.Get<Tree>("tvwItems");
to get the tree, because thats the only tree I can see.
Aug 18, 2008 at 2:46 AM
Edited Aug 18, 2008 at 4:35 AM

Hi  Vivek

      There are two tree available in the application . I ran the script with the tree that you have suggested. I get the following results.

1.  Trying to expand the tree using its Parent Name.

Tree    

tree = window.Get<Tree>("tvwItems");                                                                
Thread.Sleep(250);
tree.Node(
"Today").Expand();  

 

 

Error ==> Object reference not set to an instance of an object
 

 

1.  Trying to get the Parent Name from the treeview using the tree Index.


Tree tree = window.Get<

Tree>("tvwItems");                                            
Thread.Sleep(250); 
tree.Nodes[0].Expand();                                       // Able to expand the tree using its index values.                    
string treeName = tree.Nodes[0].Text;

 

 

 treeName ==> MS.Internal.Data.CollectionViewGroupInternal

 

 

                I am able to select the tree Items and its child usting its Index. However i am not able to do the same using its name. Say i know the value available in a tree and does not know its index , then how can i select the item name using the string. If i check out the text inside the tree, it gives me the value specified above in the "treeName". Plz suggest.

Awaiting your reply..

Thanks
Bagya

 

Aug 19, 2008 at 10:24 AM

Hi Vivek

           Did you get a chance to look at this.. Hope to see some solutions on this...

Awaiting your reply...

 Thanks

bagya

Coordinator
Aug 19, 2008 at 8:22 PM
There was similar issue with ListViewItems where WPF was not exposing the text of the cell. Have you tried putting correct ToString() method for your object behind TreeNode.