Ranorex Studio, Spy, Recorder, and Driver.
-
odklizec
- Ranorex Guru
- Posts: 7470
- Joined: Mon Aug 13, 2012 9:54 am
- Location: Zilina, Slovakia
Post
by odklizec » Tue Jan 07, 2014 9:33 am
Hi krstcs,
Thanks for your idea, but this not what I want. I mean, yes, I want to obtain a path from "repo.FormVipApplication.FirstNameInfo". The problem is that I want to pass "repo.FormVipApplication.FirstNameInfo" via string parameter:
Code: Select all
public void ReflectionCall(string repoElement) {
Type myClass = this.GetType();
var txtBox = repoElement;
...
The problem is that the repo element cannot be currently passed from recording to code using other way than string parameter. But this makes the repo element useless because it's impossible to use parameter variable (containing repo element) like this:
This is why I'm messing with "Reflection"
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
-
MarkusT
Post
by MarkusT » Tue Jan 07, 2014 3:34 pm
Hello odklizec,
Unfortunately, it is not possible to get the path out of a RepoItem object since it is stored in RepoItemInfo object only. You would need to search for your RepoItemInfo object somehow.
The following example gives an idea how you could get a RepoItemInfo object and use it to get a RepoItem object. I hope this helps you to get another approach for your issue.
public void getRepoItem(string repoItemName)
{
// get RepoItemInfo object from the item name
RepoItemInfo repoItemInfo = getRepoItemInfoObject(repoItemName);
Report.Info("Path: " + repoItemInfo.AbsolutePath);
var repoItem = getRepoItemObject(repoItemInfo);
}
public RepoItemInfo getRepoItemInfoObject(string itemName)
{
var items = repo.FormVipApplication.SelfInfo.Children;
// searches for an item name within the app folder
foreach (var item in items)
{
if (item.Name.Equals(itemName))
{
return item;
}
}
// searches for an item name within a folder
foreach (var item in items)
{
if (item.Children.Count > 0)
{
foreach (var folderItem in item.Children)
{
if (folderItem.Name.Equals(itemName))
{
return folderItem;
}
}
}
}
return null;
}
public Ranorex.Unknown getRepoItemObject(RepoItemInfo repoItemInfo)
{
var items = repo.FormVipApplication.Self.Children;
// searches for repo item with the repo item name
foreach (var item in items)
{
if (item.ToString().Contains(repoItemInfo.Name))
{
Report.Info(item.ToString());
return item;
}
}
return null;
}
Please let me know if you need further information.
Regards,
Markus (T)
-
odklizec
- Ranorex Guru
- Posts: 7470
- Joined: Mon Aug 13, 2012 9:54 am
- Location: Zilina, Slovakia
Post
by odklizec » Tue Jan 07, 2014 4:19 pm
Hi Markus,
Thank you very much! Exactly what I hoped to avoid (searching the repository)
It looks it will require a bit more work to make our part of code somewhat more universal.
OK, one last question. Do you have an information (shareable) if there are some plans to support passing repo elements via parameters (e.g. in Rx5)? I just don't want to spend time with optimizing our code only to realize the Rx5 will natively support such functionality
Thank you in advance!
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
-
monkey2012
- Posts: 77
- Joined: Wed Sep 26, 2012 8:15 pm
Post
by monkey2012 » Tue Jan 07, 2014 7:49 pm
Hi,
I am not sure if this is similar to what you need.
In my project, there are more than hundred items for each dropdown list:
Cheetah
Elephant
Lion
Tiger
Bear
:
:
and of course, I can't create those repo items manually. I only create a generic repo item with accessiblename="My Zoo Animal", I pass in "Lion" (as string) if I want to test "Lion" to my function which replace "My Zoo Animal" with "Lion"......, and so, a new repo item for Lion is created.
-
MarkusT
Post
by MarkusT » Wed Jan 08, 2014 4:04 pm
Hello odklizec,
Unfortunately, there are currently no concrete plans to implement this feature in our next major release.
Thank you for your understanding.
Regards,
Markus (T)
-
bewiss
- Posts: 16
- Joined: Mon Feb 24, 2014 3:11 pm
Post
by bewiss » Fri May 02, 2014 5:24 pm
Hi,
I would really like to have this feature implemented in the nearest future. Without, producing a lot of redundant code is unavoidable
Best regards
Bewiss
-
Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
-
Contact:
Post
by Support Team » Wed May 07, 2014 3:36 pm
Hello Bewiss,
May I ask you to send an email to
[email protected] in order to raise a feature request or to up-vote an existing feature request?
Thank you in advance.
Regards,
Robert
-
bewiss
- Posts: 16
- Joined: Mon Feb 24, 2014 3:11 pm
Post
by bewiss » Mon May 19, 2014 2:42 pm
Hi Robert,
feature request is on it's way.
Hope it will be of avail
Thx
-
bewiss
- Posts: 16
- Joined: Mon Feb 24, 2014 3:11 pm
Post
by bewiss » Fri Oct 24, 2014 10:17 pm
Hey RR-Team, thx for including this feature into the latest release 5.2
-
odklizec
- Ranorex Guru
- Posts: 7470
- Joined: Mon Aug 13, 2012 9:54 am
- Location: Zilina, Slovakia
Post
by odklizec » Mon Oct 27, 2014 8:25 am
What a great news! Thanks! I completely overlooked this improvement in 5.2 release notes
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
-
krstcs
- Posts: 2683
- Joined: Tue Feb 07, 2012 4:14 pm
- Location: Austin, Texas, USA
Post
by krstcs » Mon Oct 27, 2014 1:47 pm
Yeah, this is excellent! Thanks!!
Shortcuts usually aren't...
-
Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
-
Contact:
Post
by Support Team » Wed Oct 29, 2014 8:37 pm
Hello everyone,
That's correct. User Code actions now support arguments of different types, including repository items (RepoItemInfo or Adapter type)
A detailed description can be found on our website in the section
User Code Actions.
Regards,
Bernhard