Accessing advanced, dynamic data in user code
Posted: Mon Jul 03, 2017 3:16 pm
Hi all
In Ranorex spy (version 7.1. AUT: Java, SWT) I can see the advanced, dynamic properties of a TreeItem: What I would like to do is to access the property "DisplayName" in "Data" of the "Dynamic" section in an user code method. I've managed to get the "Data" attribute from the element associated with the Tree Item, but I don't know how to get the "DisplayName" property from the data object. Here's the code I'm working on:
Cheers,
Lawrence
In Ranorex spy (version 7.1. AUT: Java, SWT) I can see the advanced, dynamic properties of a TreeItem: What I would like to do is to access the property "DisplayName" in "Data" of the "Dynamic" section in an user code method. I've managed to get the "Data" attribute from the element associated with the Tree Item, but I don't know how to get the "DisplayName" property from the data object. Here's the code I'm working on:
IList<TreeItem> treeItems = repo.AJApp.OverviewAreas.Bookmarks.Self.Find<TreeItem>(".//treeitem", 1000); IEnumerator<TreeItem> treeIterator = treeItems.GetEnumerator(); bool itemFound = false; while (treeIterator.MoveNext() && !itemFound){ TreeItem item = treeIterator.Current; //I've managed to get the data object and can see in the debugger that it has a property called "Display Name" Object data = item.Element.GetAttributeValue("Data"); //String displayNameText = <how can I get DisplayName from data> if(bookmarkText.Equals(displayNameText)){ itemFound = true; item.DoubleClick(); Report.Success("Bookmark for" + bookmarkText + " found and clicked"); } } if(!itemFound){ Validate.Fail("No bookmark with text " + bookmarkText + " found"); }In the debugger I can see that the "DisplayName" property exists: Many thanks for your help!
Cheers,
Lawrence