Using the Conditions Elements

You can define Conditions elements in the Control\Identification\Browser element defined for a test object class. This enables UFT One to identify the controls that should be represented by this test object class, based on the control's properties, without calling an identification function.

Alternatively, you can define an identification function (per test object class or for the whole toolkit) and use the conditions to limit the times UFT One calls the function. You do this by defining that the identification function be called only in cases when the control's properties meet certain conditions.

You can define different sets of conditions for UFT One to use when running on different browsers, or you can define one set of conditions and specify that it is relevant for all browsers. For more information, see the Browser element description in the Toolkit Configuration Schema Help.

You compose the Conditions using a set of Condition elements, joined by either and or or logic. Each Condition element specifies a certain property of the HTML control, and the expected value for that property. The condition is met if the value in the control's property matches the specified value (you can specify in the condition whether the value must be equal or not equal to the specified value). You can nest Conditions elements to create complex logic.

For each set of conditions, that is for each top-level Conditions element, you specify one of the following types, instructing UFT One how to treat the control if its properties match the conditions within it:

  • IdentifyIfPropMatch. If the conditions in this element are met, use the current test object class to represent the control.

  • CallIDFuncIfPropMatch. If the conditions in this element are met, call the identification function to check this control. Otherwise, do not use the current test object class to represent the control.

  • SkipIfPropMatch. If the conditions in this element are met, do not use the current test object class to represent the control.

If an identification function is defined, and checking the conditions does not enable UFT One to determine whether to use the current test object class to represent the control, it calls the identification function.

  • If a Conditions element of type IdentifyIfPropMatch is defined, it is checked before the other types.

  • If both CallIDFuncIfPropMatch and IdentifyIfPropMatch Conditions elements are defined, the Conditions of type CallIDFuncIfPropMatch are checked only if the Conditions of type IdentifyIfPropMatch are not met.

  • If both SkipIfPropMatch and IdentifyIfPropMatch Conditions elements are defined, the Condition of type SkipIfPropMatch are checked only if the Conditions of type IdentifyIfPropMatch are not met.

  • A Conditions element of type SkipIfPropMatch is not checked if a Conditions element of type CallIDFuncIfPropMatch is defined.

  • If you nest Conditions elements, the type attribute of the nested elements is ignored.

The examples below illustrate different ways that you can use the Conditions element.

For information on the structure and syntax of the Conditions and Condition elements, see the Toolkit Configuration Schema Help.