Using the Container Attribute

By default, when UFT learns and orders objects in a Web application, it flattens the hierarchy under the parent Browser and/or Page object:

While this may make finding your object in the object repository simpler, in reality, this is often not how a real application based on a toolkit is designed. In a real application, objects are often ordered in a deep hierarchy under different objects.

To help you order and identify objects in your application, you can define the IsContainer attribute for the Control element in your toolkits. This enables UFT to learn the actual hierarchy of the objects in your application correctly and organize them accordingly in the object repository. Furthermore, this attribute can help you make a logical separation of the controls in your application.

Note: This attribute can be added to a new control added to your extensibility project or an existing control in your project.

For each Control element, you can set the IsContainer attribute to true. As a result, UFT will learn the specified attribute as a container object.

In this example, you can see that an object, called EgForm, is set to be a container object:

<Controls>
  <Control TestObjectClass="EgForm" IsContainer="true">
    <Settings>
      <Variable name="default_imp_file" value="JavaScript\EgForm.js"/>
    </Settings>
    <Identification>
      <Browser name="*">
        <HTMLTags>
          <Tag name="FORM" />
        </HTMLTags>
        <Conditions type="IdentifyIfPropMatch">
          <Condition prop_name="id" 
		expected_value=".+" is_reg_exp="true" />
        </Conditions>
      </Browser>
    </Identification>
  </Control>
</Controls>

With this implementation, UFT then sets the EgForm object to be a container object in the object repository, and all the objects contained under the EgForm object in the application are displayed as child objects of the EgForm object.