Skip to content

Tree items can not be listed #411

Open

Description

@maninwindow

I am working on a Windows desktop application that contains interactive window tree like below:
capture
(Right window will change by selecting different tree item from the left)
What i inspected by UIAVerify is below:
tree
When i select tree:
treetype
When i select one tree item:
treeitem

My code is below:

Application app = Application.AttachOrLaunch(new System.Diagnostics.ProcessStartInfo(AUT));

 var window = app.GetWindow("Main window ");

 //get all panes

 var panes = window.GetMultiple(SearchCriteria.ByControlType(ControlType.Pane));

 //get contact pane

 var pane_contact = panes[3] as Panel;

 //get option button inside pane

 var button_option = pane_contact.Items[0] as Button;

 button_option.Click();

 //Get window

 var options_Window = window.ModalWindow("window includes tree which is opened from main 
window");

 //Get tree

 var trees = options_Window.Get<Tree>(SearchCriteria.ByControlType(ControlType.Tree));

 var rootNode = trees.Nodes[0] as TreeNode;

  var nodes = rootNode.Nodes;

I can get one tree element in variable trees, but nothing in variable nodes as items.
Can anybody explain am i doing the right thing? Why it can't be found? If i was wrong, please share your idea.
Thanks in advance.

Activity

  1. maninwindow commented on May 6, 2016

    @maninwindow
    Author

    I solved problem myself.Let me share the code to help people who have the same issue.

                //open window
                //// close any open windows
                window.Focus();
                var allOpenWindows = window.GetMultiple(SearchCriteria.ByControlType(ControlType.LookupById(0x50CF6)));
                var windows = app.GetWindows().Where( w =>w.Name != window.Name);
                foreach (var item in windows)
                {
                    item.Close();
                }
                windows = app.GetWindows().Where(w => w.Name != window.Name);
                var options_Window = windows.First();
    
    
                //Get tree
                var trees = options_Window.Get<Tree>(SearchCriteria.ByControlType(ControlType.Tree));
                //move to the last tab
                for (int i = 0; i <= 13; i++)
                {
                    trees.KeyIn(KeyboardInput.SpecialKeys.DOWN);
                }
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions