07-08-2009, 05:45 PM
Hi ,
I think below code is helpful to search the object in Object Repository
' Here ObjName is Logical Name of Object and ObjProperty is the Class Name of that Object
---Hema
I think below code is helpful to search the object in Object Repository
' Here ObjName is Logical Name of Object and ObjProperty is the Class Name of that Object
Code:
Function CheckRepository(ObjName,ObjProperty)
Dim ObjRepository , AllObjects ,iCount , i , TestObject
Set ObjRepository = CreateObject("Mercury.ObjectRepositoryUtil")
ObjRepository.load "C:\Automation_V2\Object Repository\SampleObjectRepository1.tsr"
Set AllObjects = ObjRepository.GetAllObjects(Null)
iCount=AllObjects.Count
For i=0 to iCount-1
Set TestObject = AllObjects.Item(i)
If ObjName=ObjRepository.GetLogicalName(TestObject) Then
msgbox TestObject.GetTOProperty("Class Name")
If TestObject.GetTOProperty("Class")=ObjProperty Then
msgbox "Object Found in ObjectRepository"
Exit For
End If
End If
Next
Set TestObject = Nothing
Set AllObjects = Nothing
Set ObjRepository=Nothing
End Function