Tree navigation in 1-Level-Tree

Best practices, code snippets for common functionality, examples, and guidelines.
arutscheidt
Posts: 25
Joined: Mon Jan 12, 2015 8:10 am

Tree navigation in 1-Level-Tree

Post by arutscheidt » Tue Aug 01, 2017 2:21 pm

Hello everybody,

me again :-)

I have to test an application with a navigation tree. The tree has different levels which can be expanded and collapsed. However, independent on which level they are shown in the UI, the Spy lists them at the same hierarchical level as TreeItems under a tree. (See screenshots) This is correct, because it is coded in the UI. (Tested with snoop)

Unfortunately the attributes provide no information about child / parent dependencies of the single levels.
So the XPath can not distinguish between expandable nodes and their children. As you can see from the screenshots, if a level is collapsed, the sublevels are hidden or deleted from the tree. So this is a dynamically calculated solution.

The only difference I found is the indentation of the text fields via the x-coordinates, but I find that option a little bit dirty to use in the tests.

An option I can imagine is to use the AutomationID to store the parents name of each level or a path like "Root|Level A|SubLevel 1" etc. to extract that information by myself. I'm in contact to the developers and can express some whishes.


But now I want to find the best practice for this problem and so here is my question:

- Who of you have had the same problem and how did you fix that?

Some extra information:
- Node names are unique at the same level but not in the tree (e.g. "SubLevel 1")
- I want to be able to navigate to Level A -> SubLevel 2 expanding nodes if needed
- I want to know the parent of a selected sublevel
- Nodes can be added or deleted
- Nodes can be moved to another position
- when moving or copying it will still not be possible to have the same name on the same level


I hope it is clear what I'm trying to do.
Thanks for suggestions.

A. Rutscheidt


Note: I made screenshots from the Spy as well, because the snapshot would provide secret information. I think it is enough to show the problem.
Attachments
Screenshots.zip
(21.05 KiB) Downloaded 20 times
Using Ranorex Studio 8.0.1

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3921
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Tree navigation in 1-Level-Tree

Post by odklizec » Wed Aug 02, 2017 7:00 am

Hi,

I'm sorry to say this, but without (at very least) snasphot, it's next to impossible to suggest something reliable. If you cannot share the snapshot publicly, I would suggest you to contact Ranorex support at [email protected] and send the snapshot directly to them, eventually, ask for a remote session.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

arutscheidt
Posts: 25
Joined: Mon Jan 12, 2015 8:10 am

Re: Tree navigation in 1-Level-Tree

Post by arutscheidt » Wed Aug 02, 2017 9:18 am

Hi odklizec,

is there a way to snapshot just the node which is root?
I navigated to the related tree, but the snapshot will take all nodes above and show the apps name etc.
Using Ranorex Studio 8.0.1

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3921
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Tree navigation in 1-Level-Tree

Post by odklizec » Wed Aug 02, 2017 10:09 am

Try to uncheck the setting "Let snapshot contain complete ancestor subtree", as described here:
https://www.ranorex.com/forum/browsing- ... tml#p33974
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

arutscheidt
Posts: 25
Joined: Mon Jan 12, 2015 8:10 am

Re: Tree navigation in 1-Level-Tree

Post by arutscheidt » Thu Aug 03, 2017 7:34 am

Ok no more siblings now, but still the whole path from host to target. (including secrets :-(

I found some posts that Ranorex has problems with heriarchy in WPF at the moment.
So we will try the solution with parent path encrypted in the automationid or another attribute of each node.

I think for my problem the snapshot is not so important than the fact that a hierarchical UITree is not hierarchical in the Spy. I postet a screenshot how it looks like. And I provide the information that there is no way to distinguish between siblings, parents or childs in the Spy. (I analyzed all attributes manually)

So I tried to get a "best practice" from the community, because I think I can not be the first and only one with this problem :-)

But thanks for help. Have a nice day.
Using Ranorex Studio 8.0.1

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Tree navigation in 1-Level-Tree

Post by Support Team » Thu Aug 03, 2017 6:14 pm

Hello arutscheidt,

Have you tried all 3 plugins for accessing WPF elements? Generally, I recommend the new WPFImproved, but sometimes the older WPF plugins work better.
2017-08-03 13_07_21-Ranorex Studio (Administrator).png
2017-08-03 13_07_21-Ranorex Studio (Administrator).png (41.47 KiB) Viewed 519 times
Cheers,
Ned
.
Image