Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use "Mercury.ObjectRepositoryUtil" to load repositories dynamically
#1
Solved: 11 Years, 4 Months, 4 Weeks ago
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
Reply
#2
Solved: 11 Years, 4 Months, 4 Weeks ago
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.

Reply
#3
Solved: 11 Years, 4 Months, 4 Weeks ago
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
Reply
#4
Solved: 11 Years, 4 Months, 4 Weeks ago
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

Reply
#5
Solved: 11 Years, 4 Months, 4 Weeks ago
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.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#6
Solved: 11 Years, 4 Months, 4 Weeks ago Big Grin 
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
Reply
#7
Solved: 11 Years, 4 Months, 4 Weeks ago
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.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#8
Solved: 11 Years, 4 Months, 4 Weeks ago
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.

Reply
#9
Solved: 11 Years, 4 Months, 4 Weeks ago
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
Reply
#10
Solved: 11 Years, 4 Months, 4 Weeks ago
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.

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  UFT issues with Outsystems dynamically generated Id/names jherron 2 1,414 03-02-2020, 09:33 PM
Last Post: Swishy70
  Load testing in QTP newqtp 4 7,359 01-24-2019, 11:32 AM
Last Post: sonali31
  Unable to capture value of Webelement which is changing dynamically sheetal 9 16,352 02-16-2018, 11:01 AM
Last Post: janki_kakadia
  Unable to click on dynamically changing webelement preeti 0 1,827 04-29-2017, 08:50 PM
Last Post: preeti
  Adding data into rows that add dynamically with setcelldata azar81 4 5,968 04-13-2015, 05:24 PM
Last Post: vidya2k2

Forum Jump:


Users browsing this thread: 1 Guest(s)