Interview Questions   Tutorials   Discussions   Programs   Videos   

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

asked marvit August 14, 2014 02:00 AM  

How to load a object repository in QTP during runtime?


1 Answers

answered By Dharma   0  
 VB script to open QTP and load shared Object repository during runtime:

Dim qtp, qtpRep

Set qtp = CreateObject("QuickTest.Application")

qtp.Launch ‘Launches QTP

qtp.Visible = True ‘Makes QTP visible

qtp.New ‘opens a new test

Set qtpRep=qtp.Test.Actions("Action1").ObjectRepositories 'Get the current action's Object repostories collection that is Action1's Object repositories collection

If qtpRep.Find("C:\Sample test.tsr") = -1 Then 'Verifying whether the shared repository is already present in collection list. For a New test this is not required. This would be more helpful for an existing test

qtpRep.Add("C:\Sample test.tsr"),1

End If

Set qtp = Nothing

   add comment

Your answer

Join with account you already have



Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!