Retrieving and Setting Identification Property Values
More On Object Properties in QTP
The below stuff is very important and very frequently used by any QTP programmer in Object identification using QTP.
Identification properties are the set of properties defined by QuickTest for each object. You can set and retrieve a test object's identification property values, and you can retrieve the values of identification properties from a run-time object.
The below stuff is very important and very frequently used by any QTP programmer in Object identification using QTP.
Sub GetROProperty_Example2()
'The following example uses the GetROProperty method to retrieve the row
'number of the first character in the "User" field.
row = TeWindow("TeWindow").TEScreen("Sign On").TEField("User").GetROProperty("start row")
MsgBox row
End Sub
Identification properties are the set of properties defined by QuickTest for each object. You can set and retrieve a test object's identification property values, and you can retrieve the values of identification properties from a run-time object.
When you run your test or function, QuickTest creates a temporary version of the test object that is stored in the test object repository. You can use the GetTOProperty, GetTOProperties, and SetTOProperty methods in your test or function library to set and retrieve the identification property values of the test object.
The GetTOProperty and GetTOProperties methods enable you to retrieve a specific property value or all the properties and values that QuickTest uses to identify an object.
The SetTOProperty method enables you to modify a property value that QuickTest uses to identify an object.
Note: Because QuickTest refers to the temporary version of the test object during the run session, any changes you make using the SetTOProperty method apply only during the course of the run session, and do not affect the values stored in the test object repository.
For example, the following statements would set the Submit button's name value to my button, and then retrieve the value my button to the ButtonName variable:
Browser("QA Home Page").Page("QA Home Page").WebButton("Submit").SetTOProperty "Name", "my button"
ButtonName=Browser("QA Home Page").Page("QA Home Page").WebButton("Submit").GetTOProperty("Name")
You use the GetROProperty method to retrieve the current value of an identification property from a run-time object in your application.
For example, you can retrieve the target value of a link during the run session as follows:
link_href = Browser("HP Technologies").Page("HP Technologies").Link("Jobs").GetROProperty("href")
Post a Comment