Page 1 of 1

Using RxPath and Object Repository

Posted: Wed Oct 03, 2012 5:58 pm
by prashanth80
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

Re: Using RxPath and Object Repository

Posted: Thu Oct 04, 2012 8:09 am
by artur_gadomski
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

Re: Using RxPath and Object Repository

Posted: Thu Oct 04, 2012 2:55 pm
by Support Team
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