Micro Focus QTP (UFT) Forums
How to use "Mercury.ObjectRepositoryUtil" to load repositories dynamically - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: How to use "Mercury.ObjectRepositoryUtil" to load repositories dynamically (/Thread-How-to-use-Mercury-ObjectRepositoryUtil-to-load-repositories-dynamically)

Pages: 1 2


How to use "Mercury.ObjectRepositoryUtil" to load repositories dynamically - azeem - 09-16-2009

Hi All,

Could you please help me in understanding the usage of the below Object to load the repositories dynamically and usage of the object properties.

Code:
Set RepositoryDyn = CreateObject("Mercury.ObjectRepositoryUtil")
RepositoryDyn.Load "C:\QuickTest\Tests\SOR.tsr"


Thanks,
Azeem


RE: How to use "Mercury.ObjectRepositoryUtil" to load repositories dynamically - Saket - 09-16-2009

This enables you to manipulate QTP shared object repositories and their contents from outside of QTP. You need to just create an instance of the object and manipulate Repository with methods available. that means it allows you to edit properties of objects in the OR, add new objects, Copy, export.. etc using different methods.
Let me know if you need more help on this.


RE: How to use "Mercury.ObjectRepositoryUtil" to load repositories dynamically - azeem - 09-16-2009

Hi Saket - Thanks for your reply,

MY Issue IS : When I tried to run the code after loading the repository dynamically ("repositoryobject.Load "Path of OR.tsr") Its throwing error, saying that Browser object is not available.

eg:
Code:
Browser("Google").Page("Google").WebEdit("q").Set "Automation"
      Browser("Google").Page("Google").WebButton("Google Search").Click

How to use this object to run the script?

Thanks
Azeem


RE: How to use "Mercury.ObjectRepositoryUtil" to load repositories dynamically - Saket - 09-17-2009

Hi Azzem, If you are using ObjectRepositoryUtil object and Loading a particular OR files,, that does not mean that you have that OR loaded with the script, so your statements will not work.

As I have mentioned in earlier post this can be used to manipulate your OR. In case you want to dynamically load your repository that you may use QTP AOM or RepositoryCollection.Add method


RE: How to use "Mercury.ObjectRepositoryUtil" to load repositories dynamically - basanth27 - 09-17-2009

Azeem -

How are you scripting ? Is your code in QTP editor ?

As saket has already mentioned and per the QTP help, if you are using the ObjectRepositoriesUtil object then you are creating a mercury reference which is externally exploiting QTP AOM.

Approach it this way,
1.Write a Vbscript to open qtp, load repository, make it visible and then open the test.

You will know that the object reference will then be set.

Also, Please refer to QTP help for a exhaustive source of information.


RE: How to use "Mercury.ObjectRepositoryUtil" to load repositories dynamically - azeem - 09-17-2009

Basanth -

My question was very clear I want to use that object to run my script.

Does it matter to follow your approach? Smile
"1.Write a Vbscript to open qtp, load repository, make it visible and then open the test."

I dont see any new thing here...Smile

If you know let me know the code to use the object.

Thanks,
Azeem


RE: How to use "Mercury.ObjectRepositoryUtil" to load repositories dynamically - basanth27 - 09-17-2009

One of our ancestors wisely said "Spoon - Feeding exists even among adults".

It clearly indicates that you have not spent even a single moment to go through the help or my statement to understand what exactly you want to achieve.

I will write and post the code in my free time. If you have enough time you can keep refreshing the post and maybe you will get it..
Morever..I am not amused by your usage of emoticons !!! It does not reflect your seriousness in the question.


RE: How to use "Mercury.ObjectRepositoryUtil" to load repositories dynamically - Saket - 09-17-2009

Hey Azeem,
As I already mentioned in the earlier posts, The object can not be used for loading a repository into an Action neither to run yur script.
This can only be used for manipulating the OR. If you need any help on manipulating the OR please specify exactly waht do you want to manipulate, we will definitely try to help you.


RE: How to use "Mercury.ObjectRepositoryUtil" to load repositories dynamically - azeem - 09-18-2009

Hi Saket - Thanks for your response.

After my R&D on "Mercury.ObjectRepositoryUtil" and checked with Meir too, the conclusion is we can use this obj to run our scripts but you need create your own function to use this object. I just ran my code using that workaround and its working fine.

Code:
Browser("Google").Page("Google").WebEdit("q").Set "Automation"
Browser("Google").Page("Google").WebButton("Google Search").Click


As you said this object is meant for "manipulating the OR" I agree your statement and me too saw code there in help file to modify.

Thanks All - for your efforts and time spent in the usage of this object.

Thanks,
Azeem


RE: How to use "Mercury.ObjectRepositoryUtil" to load repositories dynamically - Saket - 09-18-2009

Hi Azzem,
Great man, I was not aware of this.
It is possible for you to explain the work around you have used.
I would really like to see, How can we use the ObjectRepositoryUtils object to run our script.