Hi,
Please help me understanding "How to access repository elements/controls using code?"
Suppose if have multiple modules where "Login" is one of them and my structure is to keep repository for the modules under one common folder named "Repository"
So Login repository will look like "Repository"-> LoginRepository
At the same time I am going to write my scripts, Test Cases under "Script" folder
Script-> LoginTestCases
Script-> MainPageTestCases
SO once I start writing test script in c#, I've to import or use the name space where repository belongs, correct? or any other way?
Thanks & Regards,
Sunil
How to access the login repository
How to access repository elements/controls using code?
-
- Posts: 11
- Joined: Fri Jul 03, 2015 5:35 pm
Re: How to access repository elements/controls using code?
Hi,
I'm not sure what exactly you want to achieve and how looks your solution. Could you please post a sample solution so we can better understand your issue?
Basically, if you want to access the repository from code module, you need to instantiate repository in every code module you create, like this:
I'm not sure what exactly you want to achieve and how looks your solution. Could you please post a sample solution so we can better understand your issue?
Basically, if you want to access the repository from code module, you need to instantiate repository in every code module you create, like this:
/// <summary> /// Holds an instance of the NameSpaceName.RepositoryName repository. /// </summary> private static NameSpaceName.RepositoryName repo = NameSpaceName.RepositoryName.Instance;The above code is automatically added to cs file created with new recording module.
Last edited by odklizec on Tue Jul 14, 2015 11:13 am, edited 1 time in total.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
-
- Posts: 11
- Joined: Fri Jul 03, 2015 5:35 pm
Re: How to access repository elements/controls using code?
Hi Pavel,
Thank you for reply!
I got your point, let me clarify my question.
Suppose I've a test repository named as "Test" and have to write script named as "Login" so and both of these are in different folder.
For instantiating the repository class I've to use something like "using Repository.Login" correct?
Please let me know in case if I am not clear.
Best Regards,
Sunil
Thank you for reply!

I got your point, let me clarify my question.
Suppose I've a test repository named as "Test" and have to write script named as "Login" so and both of these are in different folder.
For instantiating the repository class I've to use something like "using Repository.Login" correct?
Please let me know in case if I am not clear.
Best Regards,
Sunil
Re: How to access repository elements/controls using code?
Hi,
Sorry, but I still don't quite understand what you want to do? What's wrong with Ranorex way of doing things?
Each newly added Recording module (e.g. Login), has already instantiated default repository. So all you need to do is to start typing (in User Code) repo. and the Code Completion dialog should offer you a list of available repository elements and folders. Eventually, if you want to use Code Modules, you need to instantiate repository as described above.
Sorry, but I still don't quite understand what you want to do? What's wrong with Ranorex way of doing things?
Each newly added Recording module (e.g. Login), has already instantiated default repository. So all you need to do is to start typing (in User Code) repo. and the Code Completion dialog should offer you a list of available repository elements and folders. Eventually, if you want to use Code Modules, you need to instantiate repository as described above.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: How to access repository elements/controls using code?
Hello sunil,
As far as i understood your query and below is the suggested solution what are you looking for:
u can add the below line on top of your namespace if you have kept your repository in the other interface(or project i.e. myRepository.rxrep is under the Repo folder in the project Repository)
using Repository.Repo;
In your module or class, using myRepo you will be able to access the elements/control in your code.
var myRepo= myRepository.Instance;
As far as i understood your query and below is the suggested solution what are you looking for:
u can add the below line on top of your namespace if you have kept your repository in the other interface(or project i.e. myRepository.rxrep is under the Repo folder in the project Repository)
using Repository.Repo;
In your module or class, using myRepo you will be able to access the elements/control in your code.
var myRepo= myRepository.Instance;
Regards,
Subodh
Subodh