Saturday, 27 August 2011

Working with Test Object Properties

The following example demonstrates the usage of Test Object Properties.
' Get the webedit object
Set oedit = Browser("aaa"). Page("bbb"). webedit("")
' Get the Test Object Properties
Set TOProps = oedit.GetTOProperties
' Get the count of Test objects
Dim i, ocount 
Set ocount = TOProps.count
' Loop through the test objecs
For i=0 to count-1 
'Get the name of the property
Set oname = TOProps(i).Name
'Get the value of the property
Set oval = TOProps(i).Value
' Display the values
MsgBox "Name ---> " & oname & " Value --->" &oval

We can also modify the value of test object properties at run time by using SetTOProperty method.Assume that the test object's name is "oldname" we can use the following syntax to modify the test object property.


 objectname.SetTOProperty "oldname", "newname"

Once the above code is executed the current value of the selected test object becomes "newname".

We can use GetROProperty method to get the value of the run time object property. 

Note: QTP doesn't provide a method to modify or set the run time object property values.

0 comments:

Post a Comment

 
Back To Top