Using RxPath and Object Repository

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
prashanth80
Posts: 2
Joined: Wed Oct 03, 2012 5:41 pm

Using RxPath and Object Repository

Post by prashanth80 » Wed Oct 03, 2012 5:58 pm

I'm new to RanoRex tool and I'm trying understand as how do I access the repository in my code block which is Object from Repository Vs RxPath.

I have used the below lines to access the repository as suggested by Ranorex by specifying the RxPath it works fine

Unknown webElem = null;
WebDocument webDoc = null;
WebElement webElem = webDoc.FindSingle("/dom[@domain='xx.xxx.xxx.xxx']//div[#'silverlightControlHost']/object/form/progressbar/container[@automationid='MenuScroller']", 60000);

However, do we have a way by which we can achive the same by accessing the object repository and achive the same. Something like
<RepositoryName> repo = <RepositoryName>.Instance;
repo.domObject.find();

where repo.domObject = "/dom[@domain='xx.xxx.xxx.xxx']//div[#'silverlightControlHost']/object/form/progressbar/container[@automationid='MenuScroller']"

This makes me confusing as should I purely go with the respository (but the later is not possible) and if I go by the Ranorex path I land-up changing objects every now and then as the AUT is still under initial development phase and objects might change.

Please let me know if I'm missing something.

Thank you so much in advance.

~Prash

User avatar
artur_gadomski
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark
Contact:

Re: Using RxPath and Object Repository

Post by artur_gadomski » Thu Oct 04, 2012 8:09 am

I would suggest using Repository as if paths change you have them stored all in one location and can validate/fix all of them at once, in theory. If you code them you need to search your code or run and fix the tests as stuff change.

To answer your question about how to access Repository elements in code see Sample Solution from this post:
http://www.ranorex.com/forum/manually-w ... tml#p15361

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Using RxPath and Object Repository

Post by Support Team » Thu Oct 04, 2012 2:55 pm

Hi,

If you want to access the methods of the adapter represented by the repo item you have to use, for the root AppFolder, the following code:
repo.domObject.Self.FindSingle("...", 60000);
for normal repo itmes you can directly access the virtual adapter with:
repo.domObject.YourElement.FindSingle("...", 6000);
you can use all the methods of the specific element type which is represented by the repo item.

Regards,
Markus
Ranorex Support Team
.
Image