Wednesday, December 17, 2008

Register User Function.

Register User Function

Suppose that the FindFlights Web page contained a Country edit box, and by default, the box contained the value USA. The following example registers the Set method to use the MySet function in order to report the default value of the edit box to the test results before the new value is entered. The UnRegisterUserFunc method is then used to return the Set functionality to the standard QuickTest functionality.
Function MySet (obj, x)
dim y
y = obj.GetROProperty("value")
Reporter.ReportEvent micDone, "previous value", y
MySet=obj.Set(x)
End Function
RegisterUserFunc "WebEdit", "Set", "MySet"
Browser("MercuryTours").Page("FindFlights").WebEdit("Country").Set "Canada"
UnRegisterUserFunc "WebEdit", "Set"

No comments:

Post a Comment