Retrieving and setting values

Relevant for: GUI tests and components

description properties are the set of properties defined by UFT for each object. You can set and retrieve a test object's values, and you can retrieve the values of description properties from a run-time object.

When you run your test or component, UFT 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 action, component, or function library to set and retrieve the 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 UFT uses to identify an object.

  • The SetTOProperty method enables you to modify a property value that UFT uses to identify an object.

    Note: Because UFT 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 a description 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("HPE Technologies").Page("HPE Technologies").Link("Jobs").GetROProperty("href") 

For a list and description of description properties supported by each object, and for more details on the GetROProperty, GetTOProperty, GetTOProperties, and SetTOProperty methods, see the Common Methods and Properties section of the UFT Object Model Reference for GUI Testing.