I have a collection of repository elements in my repository neatly organized into different folders and with describing names. Now i'd like to iterate over these repository items and create a dictionary from them, with each item's name as the key and its RepoItemInfo as the value.
But can you do this in Ranorex? I'd like to be able to do this because I'm reading key-value pairs from a text file and if i'd be able to create a dictionary from my repository elements, I could supply the values for each element very easily, using the values from the text file that i read into memory.
So, something like this:
foreach (RepoItem item in formButtonsRepoFolder)
{
repoItemDict.add(item.Name, item.Info);
}
Iterating elements in a repository
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
Re: Iterating elements in a repository
Hi Makezu,
You could try somthing like that:
Sincerely,
Robert
You could try somthing like that:
//Create dictionary that holds repository items names and RepoItemInfo elements Dictionary<string, RepoItemInfo> myDict = new Dictionary<string, RepoItemInfo>(); //Sample folder which holds repo elements var anyFolderContainingRepoElements = repo.<Placeholder>.AnyFolder.SelfInfo.Children; //Add to dictionary foreach (RepoItemInfo element in anyFolderContainingRepoElements) { myDict.Add(element.Name, element); }I hope this helps.
Sincerely,
Robert
Re: Iterating elements in a repository
Thanks for the answer Robert, so it is really that simple then, I missed the fact that you can query folder's children like that.
And just to clarify, this will return me only the elements that I have added to the repository and the names I've given them in the repository, not all of the children of that element as they appear in Ranorex Spy for example?
And just to clarify, this will return me only the elements that I have added to the repository and the names I've given them in the repository, not all of the children of that element as they appear in Ranorex Spy for example?
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
Re: Iterating elements in a repository
Hi Makezu,
Exactly, only the repository elements are accessed.
Sincerely,
Robert
Exactly, only the repository elements are accessed.
Sincerely,
Robert