Create Object of Mercury.ObjectRepositoryUtil outside of QTP
Question ID: 104306
0
0

I’m trying to access Mercury.ObjectRepositoryUtil object outside of QTP for a simple vbs script. When I do this on windows xp, Windows Based Script Host crashes at the end. It seems to be related to setting the object used for the objectrepositoryutil to nothing. I then tried the same script on Windows 7 and I get "ActiveX component can’t create object: Mercury.ObjectRepositoryUtil" error. I have tried with QTP 10 installed on Windows XP, and QTP 10 and 11 installed on two Windows 7 VM’s.

I was able to register the RepositoryUtil.dll for my Windows 7 machines in QTP\\bin, and it says it succeeded. Am I missing another dll? I tried QTLoaderExt.dll but it says it was loaded but the entry-point DllRegisterServer was not found.

Code that I’m using in a vbs file:


Dim objRep, TOCollection, TestObject, Props, Property
Dim obj, Msg
Set objRep = CreateObject("Mercury.ObjectRepositoryUtil")
objRep.Load "Q:\\Terminus\\Tests\\Business Auto\\Action1\\ObjectRepository.bdb"
obj = "SwfWindow(""Accounts"").SwfWindow(""Personal Umbrella Remarks"")"
set TOCollection = objRep.GetChildren(obj) 
Msg = ""

For i = 0 to TOCollection.Count - 1 Set TestObject = TOCollection.Item(i) Msg = Msg & vbNewLine & objRep.GetLogicalName(TestObject) & vbNewLine Set Props = TestObject.GetTOProperties() For n =0 to Props.Count -1 Set Property = Props.Item(n) Msg = Msg & Property.Name & "-" & Property.Value & vbNewLine Set Property = nothing Next set TestObject = nothing 'Need to release this here or crash set Props = nothing Next

'set objRep = nothing 'If this is uncommented and the next call is commented it will crash here in XP

Msgbox Msg

set TOCollection = nothing set objRep = nothing

Any ideas? Thanks.

Marked as spam
Posted by (Questions: 2, Answers: 0)
Asked on January 7, 2011 4:30 pm
242 views
Answers (3)
0
Private answer

Set AddObjToOR = Createobject(''Mercury.objectrepositoryUtil'')
AddObjToOR.Load ''E:Repository1.tsr''
Set oBrowser = Browser(''Login'').Page(''Login'')
'Set obj = Browser(''Login'').Page(''Login'')
AddObjToOR.AddObject ''Logout'',Browser(''Login'').Page(''Login''),''Logout''
Set AddObjToOR = nothing

This code is currently not working
Need help on this

Marked as spam
Posted by (Questions: 0, Answers: 1)
Answered on February 27, 2013 1:31 pm
0
Private answer

I have a script using the Mercury.ObjectRepositoryUtil and some of the methods will cause a Pure Virtual error with QTP 10 but not QTP 11 on Windows 2003. I have tried the same script on QTP 11 Win7 64 bit and I get the same error (''ActiveX component can't create object: Mercury.ObjectRepositoryUtil'') which I think is related to 64bit OS. I am not sure if this is a bug that was fixed in QTP 10 or not.

Marked as spam
Posted by (Questions: 2, Answers: 98)
Answered on December 27, 2011 2:42 pm
0
Private answer

I have a script using the Mercury.ObjectRepositoryUtil and some of the methods will cause a Pure Virtual error with QTP 10 but not QTP 11 on Windows 2003. I have tried the same script on QTP 11 Win7 64 bit and I get the same error (''ActiveX component can't create object: Mercury.ObjectRepositoryUtil'') which I think is related to 64bit OS. I am not sure if this is a bug that was fixed in QTP 10 or not.

Marked as spam
Posted by (Questions: 2, Answers: 98)
Answered on December 27, 2011 2:42 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top