Conditions\Condition Element

Description

A single identification condition.

Important Information

  • UFT checks whether the custom control's attributes meet the requirements of the condition.
  • When comparing the value of an HTML property specified in a condition with the specified expected value, the following rules apply:
    • String value comparisons are not case-sensitive.
    • Numeric value comparisons simply compare the numeric values.
    • For Boolean value comparisons, the values true, 1, and yes are all considered true. The values false, 0, and no, are all considered false.
    • If the HTML property that you are checking returns an object, use valid and null as the expected values. The property is considered valid if it successfully returns an object, and null if the it fails to return an object.
  • If a property has more than oneexpected value, it is more efficient to use oneConditionelement and include all of the values in anOrregular expression in the expected_value attribute, than to create multipleConditionelements for the same property.

    <>    Condition prop_name="className" is_reg_exp="true"
                
       For example, the two examples below are logically equivalent, but the first will provide better performance:Example 1:
    Conditions type="IdentifyIfPropMatch"
       <             expected_value="(\bdijitTabContainer\b)|(\bdijitStackController\b)"/>
    </Conditions>

    Example 2:
    <Conditions type="IdentifyIfPropMatch" logic= “Or”>
            <Condition prop_name="className" is_reg_exp="false" expected_value="\bdijitTabContainer\b"/>
            <Condition prop_name="className" is_reg_exp="false" expected_value="\bdijitStackController\b"/>
     </Conditions>

Attributes

Name Type Use Default Description
equal boolean optional true

Indicates whether the value of the property must be equal to the specified expected value for the condition to be met.

Possible values:

  • true - property value must be equal to expected value.
  • false - property value must not be equal to expected value.
expected_value string required   The expected value of the HTML property. If the value type is a string, you can specify a regular expression. In this case, set the is_reg_exp attribute to true.
is_reg_exp boolean optional false

Indicates whether the expected value is a regular expression.

Possible values:

  • true - treat the expected value as a regular expression.
    Note: The string is treated as a regular expression even if it does not contain any regular expression characters.
    For example, if the equal attribute is set to true and the expected value is Apple, any properties whose value contains the string "Apple" (such as "Apples", "PineApple", and "Apple") fulfil the condition.
  • false - treat the expected value as a string. 
prop_name string required   The name of the HTML property whose value is checked in this identification condition.
trim boolean optional true

Indicates whether UFT should remove leading and trailing spaces from the property value and the expected value before evaluating the condition.

Possible values:

  • true
  • false

Used By

Source

<xs:element xmlns:xs="http://www.w3.org/2001/XMLSchema" name="Condition" minOccurs="0" maxOccurs="unbounded">
    <xs:annotation>
        <xs:documentation>A single identification condition.</xs:documentation>
    </xs:annotation>
    <xs:complexType>
        <xs:attribute name="prop_name" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation>The name of the HTML property whose value is checked in this identification condition.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="expected_value" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation>The expected value of the HTML property.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="is_reg_exp" type="xs:boolean" use="optional" default="false">
            <xs:annotation>
                <xs:documentation>Indicates whether the expected value is a regular expression. Possible values: true, false.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="equal" type="xs:boolean" use="optional" default="true">
            <xs:annotation>
                <xs:documentation>Indicates whether the value of the property must be equal to the specified expected value for the condition to be met. Possible values: true, false.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="trim" type="xs:boolean" use="optional" default="true">
            <xs:annotation>
                <xs:documentation>Indicates whether the value of the property and the expected value must be trimmed before the evaluation of the condition. Possible values: true, false.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
</xs:element>