Micro Focus QTP (UFT) Forums
Loading objects in qtp at run time - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Loading objects in qtp at run time (/Thread-Loading-objects-in-qtp-at-run-time)



Loading objects in qtp at run time - nitin - 12-03-2013

I was trying to load objects at run time in object repository.My object repositroy gets loaded but when i add object using addobject method I get error saying the google object was not found in repository. I have used the below code:


Code:
Set lnk = description.Create
lnk("micclass").value = "Link"
lnk("Name").value = "Web History"
set myrepository = createObject("Mercury.ObjectRepositoryUtil")
myrepository.Load "C:\Program Files\HP\QuickTest Professional\samples\Add_At_Runtime.tsr"

myrepository.AddObject lnk ,Browser("Google"),Page("Google") ' //at this line I get the error
Browser("Google").Page("Google").Link("Web History").Click
msgbox "Done"

I have already added browser and page objects to the my shared repository which I am attaching here.
Please guide me how to solve the error