How to load a object repository in QTP during runtime?

Answers were Sorted based on User's Feedback



How to load a object repository in QTP during runtime?..

Answer / nath .t

we can add object repository at runtime

Two ways are there u can add

1. when u write below syntax in Action1

Syntax: RepositoriesCollection.Add(Path)
Ex: RepositoriesCollection.Add(E:\OR\ObjRes.tsr)

if write in Action1 it will automatically add the Object
Respository to the Action1
(i.e Edit Menu-->Action-->Action Properties-->Associate
Repository tab) at runtime.

no need to add the object repository before running.

2. Add the object repository at runtime by using AOM
(Automated Object Model)

Ex:
Dim qtAppn
Dim qtObjRes

Set qtAppn = CreateObject("QuickTest.Application")
qtAppn.Launch
qtAppn.Visible = True

qtApp.Open "E:\Test\Test2", False, False
Set qtObjRes = qtApp.Test.Actions
("Login").ObjectRepositories

qtObjRes.Add "E:\OR\ObjRes.tsr", 1

The above example Add the Object Repository(ObjRes.tsr) to
the "Login" action in Test2.

Here also no need to add the object repository in Test2.

Is This Answer Correct ?    67 Yes 5 No

How to load a object repository in QTP during runtime?..

Answer / guru

StrPath = "D:\FrameWork\Repository\GoogleHomePage.tsr"
RepositoriesCollection.Add(StrPath)

Is This Answer Correct ?    25 Yes 2 No

Post New Answer

More QTP Interview Questions

in real time when we are creating the script by default it is going to save in action object repository or not any way my question is in one of my interviewer said that in real time the default object repository is action object repository and by using quick test plus they are going to merge is it correct i said that by selecting the object repository as shared one in selecting the test>>settings>>resources but she is not convinced what is the correct one

1 Answers   DigiTech, Infotech,


Can we create test script with out Step Generator?

4 Answers  


How can we log a defect in Testdirector from Q.T.P ?

2 Answers   EDS,


How can we retrieve the links from a web page where links are dynamically changing(for eg take a online shopping website) and then we have to click on all the links present in the webpage and go to the repective pages and again come back to the first page..

2 Answers  


What are the environment variables?

3 Answers  






how can we test the Triggers, Cursors, Indexes while doing Database testing in DTP??

0 Answers   ABC,


How to get align property of the link on web page?

1 Answers  


if we can find the status of script in qtp that either it's pass or fail then why we need to put this status on different excel file or log file in hybrid framework .please let me know asap thanks

1 Answers   iCreate,


How to remove associated function library?

0 Answers  


what is main diff of qtp8.2 and qtp9.0?

1 Answers   Covansys,


What are the problems / difficulties faced when you used Smart Identification ?

2 Answers   Keane India Ltd,


What is an other way of "Wait" statement in QTP I dont want to use wait("Some number"). Can any one tell this please..........

10 Answers   ADP, AZTEC,


Categories