Hi,
I have an object in repository like this:
element[@id='hdyPastGrid']/element[3]/element/listitem/text[@caption='Test']
what I want to do is to parameterize that "caption='Test'" part. Make this caption of a parameter class I defined before. I can't use regular expression here because I want the caption to be specific.
Thanks,
Ruser
How can I parameterize part of object in repository
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How can I parameterize part of object in repository
There are many things you could meaning with this question, but if you have a look at the user guide. The topic RanoreXPath: http://www.ranorex.com/support/user-gui ... xpath.html. It has a section on using the path in code. Also in version 2.2 of Ranorex you can use associated info property of the element in the Repository to change the path at run time.
Here you can find an example code for version2.2:
Ron
Ranorex Team
Here you can find an example code for version2.2:
// The info item for following repo item: “repo.FlexTestPageDom.ContainerComboBox.Button3” Report.Info(repo.FlexTestPageDom.ContainerComboBox.Button3Info.Name); repo.FlexTestPageDom.ContainerComboBox.Button3Info.Path = "element[@id='hdyPastGrid']/element[3]/element/listitem/text[@caption='" + Test_Variable + "']";Regards,
Ron
Ranorex Team
Re: How can I parameterize part of object in repository
But you can also create a new Button-object/adapter of the dynamically created XPath in the code. That is even possible in the versions before 2.2. What is the advantage of the solution with the info poperty?
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How can I parameterize part of object in repository
That's right. The advantage of the method stated by Ron is that you just need to adopt the path of a repository item once, e.g. at the beginning of your recording using a user code record item, and can leave the rest of the recording untouched. The repository item will have the changed path from then on.max wrote:But you can also create a new Button-object/adapter of the dynamically created XPath in the code. That is even possible in the versions before 2.2. What is the advantage of the solution with the info poperty?
Regards,
Alex
Ranorex Support Team