Parsing t hrough tree items using vbscript

Class library usage, coding and language questions.
[email protected]
Posts: 2
Joined: Tue Dec 11, 2018 8:12 am

Parsing t hrough tree items using vbscript

Post by [email protected] » Tue Dec 11, 2018 8:18 am

How to access the elements under a treeitem using vbscript. Also need to know how to store similar type of objects using vbscript.
Attachments
tree item.png
Screenshot
tree item.png (97.08 KiB) Viewed 88 times

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

Re: Parsing t hrough tree items using vbscript

Post by odklizec » Tue Dec 11, 2018 9:28 am

Hi,

At first, please upload a Ranorex snapshot (NOT screenshot) of the problematic tree element. Screenshot is unfortunately useless. Then please describe in more details, what exactly do you want to achieve? I'm not sure what you mean by "storing similar type of objects using vbscript"? Thanks.

BTW, Ranorex does not support VBScript, but VB .Net. This is, I believe a huge difference?
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

[email protected]
Posts: 2
Joined: Tue Dec 11, 2018 8:12 am

Re: Parsing through tree items using vb.net

Post by [email protected] » Tue Dec 11, 2018 8:19 pm

The xpath to see the element is:
/form[@name~'^Prose\ \(DELPHIX\)\ -\ \(1\.0\.12']/container[@automationid='BarManagerbar']/container[@automationid='MyDockLayoutManagerRegion']//container[@automationid='LayoutPanel_LayoutPanel(47299748)']//container[@automationid='dockMgr']/?/?/container[@automationid='BlotterLayoutGroup']/container[@automationid='GridView']/?/?/container[@automationid='BarManagerbarManager0']//treeitem[@name~'^\[Worksheet]WorksheetID::7']

Under the tree item there are many elements present. I want to click on to the check box to be precise. So I exactly want to know how do I do some operation on the elements under a TreeItem.

My another question is lets say in a container there are 10 checkboxes. How do I parse through all the checkboxes or I click on the checkbox using indexing using VB.net. How do I store all the checkboxes like in C# we use List so in VB.net what is the data structure used.

Thanks
Attachments
Tree Elements.rxsnp
Ranorex snapshot
(210.88 KiB) Downloaded 3 times

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

Re: Parsing t hrough tree items using vbscript

Post by odklizec » Wed Dec 12, 2018 9:14 am

Hi,

Thanks for the snapshot. Let's start with the bad news...

The checkboxes you want to click, does not appear to be available/visible for Ranorex. At least they are not available in the snapshot. Are you able to track the individual grid checkboxes with spy?

At next, you are using obsolete Ranorex version 8.2.0. Please update Ranorex with most recent 8.3.1 and try it again. There were many changes and fixes introduced between 8.20 and 8.3.1. It's better to use most recent version instead of debugging the problem on an already obsolete version ;)

As for the list of checkboxes, I would suggest you to check this sample code, describing how to create a list of adapters (there is both VB .Net and C# code):
https://www.ranorex.com/help/latest/han ... oryelement
But as mentioned, the checkboxes you are looking for, are not available in snapshot and therefore, you may be unlucky to get the list of them.

Basically, the grid in question is implemented without automation/accessibility in mind and therefore, Ranorex (most probably any test automation tool) is unable to obtain certain elements in the grid. What kind of GUI technology is behind the grid?
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

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

Re: Parsing t hrough tree items using vbscript

Post by odklizec » Wed Dec 12, 2018 9:27 am

OK, slight correction ;) Event though Ranorex does not identify exactly the checkboxes, it still sees the grid cells and those with checkboxes seem have attributes, which could help you to identify a cell with checkbox.

For example, this xpath identifies all cells with checked and unchecked checkboxes:
/form[@name~'^Prose\ \(DELPHIX\)\ -\ \(1\.0\.12']/container[@automationid='BarManagerbar']/container[@automationid='MyDockLayoutManagerRegion']//container[@automationid='LayoutPanel_LayoutPanel(47299748)']//container[@automationid='dockMgr']/?/?/container[@automationid='BlotterLayoutGroup']/container[@automationid='GridView']/?/?/container[@automationid='BarManagerbarManager0']/?/?//tree[@automationid='grd']/container[@automationid='dataPresenter']//element[@uiautomationvaluevalue='Unchecked' or @uiautomationvaluevalue='Checked']
But because some of them are invisible (and therefore not clickable), I would add 'visible' attribute at the end of xpath:
/form[@name~'^Prose\ \(DELPHIX\)\ -\ \(1\.0\.12']/container[@automationid='BarManagerbar']/container[@automationid='MyDockLayoutManagerRegion']//container[@automationid='LayoutPanel_LayoutPanel(47299748)']//container[@automationid='dockMgr']/?/?/container[@automationid='BlotterLayoutGroup']/container[@automationid='GridView']/?/?/container[@automationid='BarManagerbarManager0']/?/?//tree[@automationid='grd']/container[@automationid='dataPresenter']//element[@uiautomationvaluevalue='Unchecked' or @uiautomationvaluevalue='Checked'][@visible='true']
If you want to identify a checkbox, belonging to certain treeitem, you can use something like this:
/form[@name~'^Prose\ \(DELPHIX\)\ -\ \(1\.0\.12']/container[@automationid='BarManagerbar']/container[@automationid='MyDockLayoutManagerRegion']//container[@automationid='LayoutPanel_LayoutPanel(47299748)']//container[@automationid='dockMgr']/?/?/container[@automationid='BlotterLayoutGroup']/container[@automationid='GridView']/?/?/container[@automationid='BarManagerbarManager0']/?/?//tree[@automationid='grd']/container[@automationid='dataPresenter']/treeitem[@name~'US Large Cap Equity']//element[@uiautomationvaluevalue='Unchecked' or @uiautomationvaluevalue='Checked']
But once again, if the xpath returns an invisible (hidden) element, you may not be able to click it without making it visible (e.g. using EnsureVisible).
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