Sunday 10 November 2013

GetTOProperty,SetTOProperty,GetROProperty



Test Object - Object value and property present in the Object Repository and

application while recording.

Is an object that QuickTest creates in the test to represent the actual object in the application.QTP stores information
about the object that will help to identify and check the object during the test run.


Runtime Object - Object value and property present in corrent application

while execution.

Is an actual object in the application on which methods are performed during the test run.

GetTOProperty - We can retrieve any property value of the test object.

Ex:


systemutil.Run "iexplore.exe", "http://www.google.com"

Set oWebEdit=Browser("Google").Page("Google").WebEdit("q") 'Create webedit object

Set TOProperties=oWebEdit.GetTOProperties 'Get TO Properties

For i = 0 to TOProperties.count - 1 'Looping through all the properties
    sName=TOProperties(i).Name ' Name of the property
    sValue=TOProperties(i).Value 'Value of the property
    isRegularExpression=TOProperties(i).RegularExpression 'Is it a Regular expression
    Msgbox sName & " -> " & sValue & "->" & isRegularExpression
Next

'##############
'### Result:###
'##############
' type -> ext -> true
' name -> q -> true
'### End of Script ####




SetTOProperty - We can set any property value of the test object.


EX:

oldName = oWebEdit.GetTOProperty("name")
msgbox "Old Name ->" & oldName
oWebEdit.SetTOProperty "name","New Value"
NewName = oWebEdit.GetTOProperty("name")
msgbox "New Name ->" & NewName

'##############
'### Result:###
'##############
' Old Name ->q
' New Name ->New Value
'### End of Script ###



GetROProperty - We can retrieve any property value of the Runtime object.

Ex :

Browser("Page").Page("Page").Navigate "www.google.com"
Browser("Page").Page("Page").WebEdit("q").set "arunrajvdm"
msgbox Browser("Page").Page("Page").WebEdit("q").GetROProperty("value")


We can not set any property value of the Run time object.

No comments:

Post a Comment