Micro Focus QTP (UFT) Forums
find the property value of a run time object - 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 Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: find the property value of a run time object (/Thread-find-the-property-value-of-a-run-time-object)



find the property value of a run time object - reejais - 10-28-2010

Hi All,

I am creating a runtime object like below.

Code:
Set ObjOpCoCode = Description.Create()
ObjOpCoCode("micclass").value = "Link"
ObjOpCoCode("html tag").value = "A"
ObjOpCoCode("text").value = DataTable.Value("OPCOCodeToEdit","rTD")
ObjOpCoCode("name").value = DataTable.Value("OPCOCodeToEdit","rTD")
ObjOpCoCode("hash").value = "#[0-9]{1,}"

Now I want the value of this hash at runtime. How can I do this.

I tried putting this statement
Code:
OpCoCodeId =browser("").Page("").Link(ObjOpCoCode).GetROProperty("hash")
msgbox "OpCoCodeId= "&OpCoCodeId
But the msgbox prints empty OpCoCodeId.

Does anybody have an idea?

Thanks in advance for all your help

Regards,
Reema.


RE: find the property value of a run time object - KVK - 10-28-2010

Hi reejais,

Spy on the object and check if any value is displayed for hash property for that object.

I belive there is no run time value for that property. If you notice that the run time value is not null, than correct your description object,
Code:
Set ObjOpCoCode = Description.Create()
ObjOpCoCode("micclass").value = "Link"
ObjOpCoCode("html tag").value = "A"
ObjOpCoCode("text").value = DataTable.Value("OPCOCodeToEdit","rTD")
ObjOpCoCode("name").value = DataTable.Value("OPCOCodeToEdit","rTD")


- Vinod


RE: find the property value of a run time object - A.Saini - 10-28-2010

Hi Reema,

Try this code:

Code:
'  Creating a child object.
Set ObjOpCoCode = Description.Create()
ObjOpCoCode("micclass").value = "Link"
ObjOpCoCode("html tag").value = "A"
ObjOpCoCode("text").value = DataTable.Value("OPCOCodeToEdit","rTD")
ObjOpCoCode("name").value = DataTable.Value("OPCOCodeToEdit","rTD")
ObjOpCoCode("hash").value = "#[0-9]{1,}"


' Making the collection object
Set OpCoCodeId =browser("").Page("").ChildObject(ObjOpCoCode)

' Doing the  count of  objects
intCount=OpCoCodeId.count

' Getting the desired property from the object
For iCnt =1 to intCount
  strHash = OpCoCodeId(iCnt).GetROProperty("hash")
  print strHash
Next

It should work.....Smile


RE: find the property value of a run time object - reejais - 10-28-2010

Hi Vinod,

There is a value displayed for hash property for that object.

eg. if OPCOCodeToEdit = TEST in external file

This TEST link has a hash property as "#1002"

Since my OPCOCodeToEdit will be changing and the hash value will be different for different OPCO Code. I do not know the value for hash property when I am creating the object. All I know is it will be something like this "#****"

Now i want to know the value of this hash at runtime.

Can I use GetROProperty with the object that I have created at runtime?

Thanks and Regards,
Reema.
Hi Ankur,

Thanks for the help.

The code is giving an "general run error" on line

Code:
strHash = OpCoCodeId(iCnt).GetROProperty("hash")

I am trying to find out meanwhile if you have an idea please let me know.

Thanks and Regards,
Reema.