Extracting a string from a treeview - use RanorexPath?

Ranorex Studio, Spy, Recorder, and Driver.
TomBrad
Posts: 17
Joined: Mon Mar 30, 2020 12:00 pm

Extracting a string from a treeview - use RanorexPath?

Post by TomBrad » Fri Jun 17, 2022 6:15 pm

I have a dialog which contains a treeview. The treeview contains a tree item which has a long string. I want to extract part of this string to use in validation at a later point in the test.

How do I access the string, and assign it to a variable? Do I use the RanorexPath? I am not currently familiar with how to go about this, so would appreciate an example that I could adapt.

Thanks

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

Re: Extracting a string from a treeview - use RanorexPath?

Post by odklizec » Mon Jun 20, 2022 12:25 pm

Hi,

It's impossible to suggest something reasonable without seeing, at very least, a Ranorex snapshot (NOT screenshot) of the problematic element and whole tree. Could you please create the snapshot and publish it here?
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

TomBrad
Posts: 17
Joined: Mon Mar 30, 2020 12:00 pm

Re: Extracting a string from a treeview - use RanorexPath?

Post by TomBrad » Mon Jun 20, 2022 1:42 pm

Hi Odklizec, my employer will not allow me to create a Ranorex snapshot, but I can show you the RanorexPath. In the path below, the values of '10000', '20000' and 'TEXTSTRING' are example values.

/form[@title>'[T.I.B] MyApp']/container[@controlid='10000']/form[@controlid='20000']//tree[@class='TreeView20WndClass']/?/?/treeitem[@text>'TEXTSTRING']

The main window is the form, with my initials on it (T.I.B). Then there is a container with a control ID of 10000 - this is the client area of the main window.

Underneath that is a form, its control ID is 20000.

The form displays the text in a treeview which I want to extract a string from.

In the form, the structure is as follows:

This form has a container, which is a ThunderRT6UserControlDC.
In this container there is an element.


Within that element is a TreeView20WndClass.

It has a treeitem which contains a string. In the path above, I've represented this as TEXTSTRING. The string will vary depending on the state of the database and some inputs in the test which are carried out before this form is opened.

During the testing so far, Ranorex has been able to drill-down and access the treeview, although the UI uses some old Visual Basic controls.

I hope this is sufficient information - I'm sorry I'm not permitted provide the Ranorex snapshot. Thank you for your help.
What I want to be able to do is read from the treeitem's TEXTSTRING into a variable, and then reference the variable's value later in the test procedure. I also need to allow for the fact that the contents of the TEXTSTRING may be different on different occasions, so I cannot assume or hard-code any variable values.

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

Re: Extracting a string from a treeview - use RanorexPath?

Post by odklizec » Mon Jun 20, 2022 2:11 pm

Hi,

I'm sorry, but without snapshot, I can only suggest you to search this forum and examine all available TreeView posts and eventually find the proper solution.

If you know how to uniquely identify a tree item, it should be enough to use either Get Value recording action or GetAttributeValueText("Text") coded action, to obtain the string from the tree item.
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

TomBrad
Posts: 17
Joined: Mon Mar 30, 2020 12:00 pm

Re: Extracting a string from a treeview - use RanorexPath?

Post by TomBrad » Mon Jun 20, 2022 5:40 pm

Thanks Odklizec, I'll try the GetValue method you suggest.