Jump to content

Question on tree scope and UI Automation


zenocon
 Share

Recommended Posts

The documentation on the tree scope even on Microsoft's site https://msdn.microsoft.com/en-us/library/windows/desktop/ee671699(v=vs.85).aspx isn't exactly clear to me.  

Let's say there's this hierarchy

desktop
├── app
│   ├── elem1
│   ├── elem2
│   ├── elem3
│   │   ├── elem4
│   │   └── elem5
│   ├── elem6
│   ├── elem7
│   │   ├── elem8
│   │   │   └── elem9
│   │   ├── elem10
│   │   │   └── elem11
│   ├── elem12
│   │   ├── elem13
│   │   └── elem14

I'm mainly interested in only $treescope_descendants, $treescope_subtree, $treescope_children, since I think the others aren't supported.

Can someone indicate what the explicit differences are?  

My guess is _UIA_getObjectByFindAll($app, <selector-that-matches-elem5>, $treescope_children) would fail to find elem5 because elem5 is not a direct child of $app, but _UIA_getObjectByFindAll($app, <selector-that-matches-elem5>, $treescope_subtree) would because it will descend down recursively from all children rooted under $app.

Is that a correct statement?

If so, can someone explain what $treescope_descendants is for?  It sounds like $treescope_descendants is the same as $treescope_subtree but it does not include the top-level element you're starting the search from, whereas $treescope_subtree does include that top-level element and all descendants recursively.

Link to comment
Share on other sites

Its well explained over here in the tree sections

https://msdn.microsoft.com/en-us/library/windows/desktop/ee684007(v=vs.85).aspx

Your explanation is nice like a square is equal to a triangle except square has 4 corners instead of 3.😄

You are right that it includes the starting element.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...