Hi,
I want to read the name(label) of the treeitem, the items do not have the 'Text' attribute set.
I have attached a screen shot of the tree showing the treeitems eg I want to get the text "204-00 Suspension system (140)" when I click on it, is there any of getting that text, also the tree is in a NativeWindow
My Code is :
public void Mouse_DoubleClick_Tree338()
{
TreeItem SignalsTree = "/dom[@domain='localhost:8080']//object[#'Tabman']//element[@instance='1']/element[@instance='0']//tree[@controlid='338']/treeitem[2]";
SignalsTree.Click();
foreach (Ranorex.TreeItem item in SignalsTree.Items)
{
item.Expand();
item.Click();
//string itemName = item.Text;
Report.Info("item.Text);
IterateTree(item);
}
}
static void IterateTree(Ranorex.TreeItem treeItem)
{
foreach (Ranorex.TreeItem item in treeItem.Items)
{
item.Click();
Report.Info(item.Text.ToString());
}
}
TreeItem Label Text
TreeItem Label Text
You do not have the required permissions to view the files attached to this post.
Re: TreeItem Label Text
Hi,
If the tree element texts cannot be found anywhere in the Ranorex spy, then I'm afraid, your only hope are RawTexts. To be able to read the RawTexts, you need to add the SysTreeView32 class to the GDI capture list. See this tutorial how to extend the GDI capture list... http://www.ranorex.com/support/user-gui ... tions.html
Hope this helps?
If the tree element texts cannot be found anywhere in the Ranorex spy, then I'm afraid, your only hope are RawTexts. To be able to read the RawTexts, you need to add the SysTreeView32 class to the GDI capture list. See this tutorial how to extend the GDI capture list... http://www.ranorex.com/support/user-gui ... tions.html
Hope this helps?
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: TreeItem Label Text
Hi,
Thanks for your reply, but I don't see the option to add class name to GDI Capture list when I right click on the items, is there a setting I need to activate ?
Regards
zshadow
Thanks for your reply, but I don't see the option to add class name to GDI Capture list when I right click on the items, is there a setting I need to activate ?
Regards
zshadow
Re: TreeItem Label Text
Try right click the tree root element (not the individual tree items). Tree '338' as from your screenshot.I believe it's also possible to add the class name manually? Just enter SysTreeView32 to the GDI Capture list. Then restart/refresh Spy to see the effect.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: TreeItem Label Text
Hi,
I had to use the option "Add to Repository (incl. Children)" to add the tree Items I am not sure if that's the correct way to do it?
Regards
zshadow
I had to use the option "Add to Repository (incl. Children)" to add the tree Items I am not sure if that's the correct way to do it?
Regards
zshadow
Re: TreeItem Label Text
Hi,
No, this is not it. You need to use "add class name to GDI capture list".
No, this is not it. You need to use "add class name to GDI capture list".
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: TreeItem Label Text
Hi,
I did what you suggested, now I want to match a variable string against of the rawtext items, as some of them are not visible, how would you check for their existence ? I tried the code but doesn't find the element. Is there any way of finding the rawtext when it is not visible?
Also I was wondering if I could get the rawtext by doing something like this :
Thanks
zshadow
I did what you suggested, now I want to match a variable string against of the rawtext items, as some of them are not visible, how would you check for their existence ? I tried the code but doesn't find the element. Is there any way of finding the rawtext when it is not visible?
Code: Select all
Button dBtn = "/dom[@domain='localhost:8080']//object[#'Tabman']//element[@instance='1']/element
[@instance='0']//tree[@controlid='338']/scrollbar[@style='Vertical']/button[@text='Down']";
Delay.Milliseconds(500);
Button dBtn = "/dom[@domain='localhost:8080']//object[#'Tabman']//element[@instance='1']/element
[@instance='0']//tree[@controlid='338']/scrollbar[@style='Vertical']/button[@text='Down']";
Delay.Milliseconds(500);
RawText rrtxt1 = "/dom[@domain='localhost:8080']//object[#'Tabman']//element[@class='481D9404-6E8D-4c7c-ACC7-
63DDC8D5F555']/element[@instance='1']/element[@instance='0']//tree[@controlid='338']/rawtext[@rawtext='+var_string+']";
do {
Report.Info("not visible");
dBtn.Click();
} while (!rrtxt1.Visible);
Report.Info("RowText = "+rrtxt1.ToString());
rrtxt1.DoubleClick();
Code: Select all
TreeItem SignalsTree = "/dom[@domain='localhost:8080']//object[#'Tabman']//element[@instance='1']/element[@instance='0']//tree[@controlid='338']/treeitem[2]";
SignalsTree.Click();
foreach (Ranorex.TreeItem item in SignalsTree.Items)
{
Report.Info("text = "+item.GetType().GetProperty("Text").GetValue(item, null).ToString());
}
zshadow
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: TreeItem Label Text
Hello zshadow,
Unfortunately, it is not possible to check the visibility of a rawtext element since the item cannot be identified if it’s invisible. The graphical user interface (GDI) is used for drawing elements on the screen. If the specific element is not visible (not drawn) Ranorex cannot recognize the element via the GDI Plug-In . Maybe an image-based approach could solve your issue.
Regards,
Robert
Unfortunately, it is not possible to check the visibility of a rawtext element since the item cannot be identified if it’s invisible. The graphical user interface (GDI) is used for drawing elements on the screen. If the specific element is not visible (not drawn) Ranorex cannot recognize the element via the GDI Plug-In . Maybe an image-based approach could solve your issue.
Regards,
Robert
Re: TreeItem Label Text
Hi Robert,
Is it possible to convert the tree items below to be converted to images some how and validate ag
ainst a string depicted in the image, using the image method as stated in the TreeItem Class shown below?
Or any other way?
Image The image or icon associated with the tree item.
http://www.ranorex.com/Documentation/R ... eeItem.htm
Regards
Navin
Is it possible to convert the tree items below to be converted to images some how and validate ag
ainst a string depicted in the image, using the image method as stated in the TreeItem Class shown below?
Or any other way?
Image The image or icon associated with the tree item.
http://www.ranorex.com/Documentation/R ... eeItem.htm
Code: Select all
TreeItem SignalsTree = "/dom[@domain='localhost:8080']//object[#'Tabman']//element[@instance='1']/element[@instance='0']//tree[@c[b][/b]ontrolid='338']/treeitem[2]";
SignalsTree.Click();
foreach (Ranorex.TreeItem item in SignalsTree.Items)
{
item.Expand();
item.Click();
//string itemName = item.Text;
Report.Info("item.Text);
IterateTree(item);
}
Navin
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: TreeItem Label Text
Hello,
As already discussed via email:
The suggested imaged based recording/validation will only work with images. So, you cannot compare the images from a tree item with a string value.
Regards,
Robert
As already discussed via email:
The suggested imaged based recording/validation will only work with images. So, you cannot compare the images from a tree item with a string value.
Regards,
Robert