Micro Focus QTP (UFT) Forums
Error while adding Object to Object repository 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: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: Error while adding Object to Object repository at run time (/Thread-Error-while-adding-Object-to-Object-repository-at-run-time)



Error while adding Object to Object repository at run time - SaranKumarV - 10-11-2010

Hi All,

I am trying to add new object to object repository in run time with the following code resulting "error : R6025 -pure virtual function call" please help me on this.

Code:
Set RepositoryFrom  = CreateObject("Mercury.ObjectRepositoryUtil")
RepositoryFrom.Load  "c:\testrep.tsr"
Set PageObj = RepositoryFrom.GetObjectByParent("Browser(""Google"")","Page(""Google"")")
Set CustomObj = Browser("Google").Page("Google").WebButton("micclass:=WebButton")
RepositoryFrom.AddObject CustomObj, PageObj
RepositoryFrom.Save
Set RepositoryFrom = Nothing

Regards,
SaranKumarV


RE: Error while adding Object to Object repository at run time - Saket - 10-21-2010

I guess you are running this code in QTP, remove the below statement from your script and put it in a vbs file. attach the vbs with your test. an try.
Code:
Set RepositoryFrom = CreateObject("Mercury.ObjectRepositoryUtil")



RE: Error while adding Object to Object repository at run time - cdesserich - 10-22-2010

Make sure you release the "PageObj" object as well!

Code:
Set PageObj = Nothing

This should fix the error.


RE: Error while adding Object to Object repository at run time - dubeyvin - 02-02-2015

Can we also Rename Object's Logical name at the Runtime?
I tried with the following code :
Code:
Set mR = CreateOBject("Mercury.ObjectRepositoryUtil")
    mR.Load "C:\Users\Documents\ObjectRepository.bdb"
    mR.RenameObject Browser("TEstFolder").Page("abc"),"def"

I have tried to save it in the VBS file and then attached to the Test
But I am getting Error as : Object Can not be Renamed

I have also attached the Screenshot of the error