Open topic with navigation
To support a custom control, UFT must be able to identify which test object class to use for a specific control. Therefore, a crucial stage in developing support for a custom control, is creating rules that enable UFT to correctly map the control to the test object class that represents it.
Extensibility Accelerator provides a point-and-click mechanism that helps you automate this process. You click on controls that you want to be represented by the test object class, and Extensibility Accelerator generates mapping rules for the test object class based on the properties of the selected controls.
These rules are stored in the toolkit configuration file (
WebExtSample.xml), in Identification elements defined within each Control element. Each Control element defines a test object class. The Identification element specifies which controls should be represented by that test object class.
In this section, you use the mechanism provided in the Map to Controls Tab (Test Object Class Designer), to create mapping rules for the sample Book control.
In the main document area of Extensibility Accelerator, select the tab for the WebExtBook test object class designer.
If you closed the designer, open it from the Class View by double-clicking the WebExtBook in the list of test object classes for your project.
Select the Map to Controls tab from the tabs on the left side of the test object class designer.
Run the sample application by opening the
%ALLUSERSPROFILE%\Documents\ExtAccTool\Samples\WebExtSample\Application\Book.htm file in a supported version of Microsoft Internet Explorer.
Make sure that running scripts in the browser is enabled.
In some cases, different rules for mapping the test object class to a control must be used, depending on the version of the browser running the control. In those cases, click the Add Browser-Specific Rules button on the tab next to the Default Rules tab, to create additional sets of rules.
For the book control, you only need one set of rules for all supported browser versions, and the rule is used to identify the control.
Click Select Controls in the Identify Control panel in the Default Rules tab.
Extensibility Accelerator is hidden, and two buttons are displayed at the top of the screen: Create Rules and Cancel.
The mouse pointer is converted to a pointing hand.
Each control that you move over is highlighted in the application, and the name of the HTML element that represents the control is displayed. In the image below, the TD HTML element is displayed for the area that contains the book title:
Click on the area that contains the book title, selecting the TD element displayed above.
The Selection Dialog Box opens on top of the browser, displaying the HTML properties of the element:
This is not the element that represents the Book control itself. The top part of the dialog box displays the HTML hierarchy of the TD element, including the TABLE element that represents the Book control.
Click on TABLE in the HTML element hierarchy.
The properties of the TABLE element are displayed.
Click Create Rules to end the control selecting session.
Based on the properties of the TABLE element, Extensibility Accelerator creates mapping rules for the test object class in the Rule Creation Panel.
The rules match the conditions you planned in Plan Support for the Web Add-in Extensibility Book Sample Toolkit:
tagName = table, className = Book.
Tip: When you develop support for your own controls, you should select more than one control during a session. This enables Extensibility Accelerator to create more accurate rules, which identify all controls of the relevant type and not only the specific control that you selected.
In this step, you verify that the automatically created rules identify the Book control in Internet Explorer.
Click the Test Rules button, located beneath the rules.
The Book control is highlighted in the browser, and a Done button is displayed at the top of the screen. (You may need to bring the browser into focus manually.)
Click Done and then save your changes in Extensibility Accelerator.
In the Project Viewer, double-click the
WebExtSample.xml file. In the file, you can see the Identification element defined in the WebExtBook's Control element. It contains a browser independent Conditions elements that contains two conditions, both of which must be met for the control to qualify as a WebExtBook:
<Control TestObjectClass="WebExtBook"> <Identification> <Browser name="*"> <Conditions type="IdentifyIfPropMatch"> <Condition prop_name="className" expected_value="Book" /> <Condition prop_name="tagName" expected_value="TABLE" /> </Conditions> </Browser> </Identification> </Control>
For details on defining the Identification element for a test object class, see the section on teaching UFT to identify the test object class to use for a custom Web control in the Micro Focus UFT Web Add-in Extensibility Developer Guide, and the