Implementing a Filter for Learning Child Controls

When you instruct UFT to learn a Web page, the Define Object Filter dialog box opens, enabling you to determine which of the Web page's descendants should be learned with it. When you select All object types, instructing UFT to learn the custom control with its parent Web page, all of the controls contained within your custom control are also learned as children of that Web page (and siblings of the control itself).

In some situations, there is no need to create test objects for all of the children of a control. For example, when there are no significant operations to perform on the children and no properties to retrieve, or when, for testing purposes, operations performed on the children are viewed as operations performed on the parent control. For example, on a calculator control that contains button controls, there is no need to create test objects for the digit buttons. Pressing the digit buttons performs a Set operation on the calculator object itself, providing a numeric input for a calculator operation.

You can determine which controls UFT learns by defining a Learn Filter for the test object class you create. You can use the Control\Filter\Learn element in the toolkit configuration file to define basic filtering, or you can implement complex filters by writing a JavaScript function. If you design a filter using a JavaScript function, specify the location and name of the function in the toolkit configuration file.

In the toolkit configuration file, in the Control\Filter\Learn element, you can define:

For more information, see the Toolkit Configuration Schema Help.

You can see an example of defining Learn Filters in the sample toolkit support set for the WebExtSample environment located in %ALLUSERSPROFILE%\Documents\ExtAccTool\Samples\WebExtSample folder.

After you implement a Learn Filter, you can instruct UFT to learn your custom controls, and verify that your toolkit support set correctly controls which of the control’s children are learned. For more information on testing your toolkit support set, see Testing the Toolkit Support Set During Development.