Event listening and recording - Use-case scenario

When you are creating your test, you may want UFT to record a specific event on an object. As a result, instruct UFT to listen for the event and to record the event when it occurs.

In this use-case scenario, you are trying to record an onmouseoverevent for a table cell containing two images. When the mouse moves over either of the images contained in the table cell, the event bubbles up to the cell, and the bubbling action includes information on the image that the mouse moved over. You want to record the steps performed on the images.

In order to enable UFT to record the image mouseover event, do a number of things:

  • In the Custom Web Event Recording Configuration Dialog Box, configure the mouseover event for the <TD> tag (table cell) to If Handler. You also disable the Record for the cell to Never, thereby disabling the recording option. This enables UFT to "hear" the mouseover event on the table cell when it happens in the application but not record the event as part of the test flow. (This is important because the actual "work" of the application is done with the images contained in the table cells.)

  • Also in the Custom Web Event Recording Configuration Dialog Box, disable listening on the <IMG> tag (the image) by setting the Listen option to Never. In addition, you set the Record option on the image(s) to Enable. This enables UFT to record the actual action on the images.

    By setting the recording to be done on the images, but listening to be done on the table cells, you have taught UFT that while something happens (the images appear) when you mouseover the table cell, the important part and the objects to include in the test flow are the images that appear when performing a mouseover on the table cell.

You can also record the actions on the images by setting the Listen option on the <IMG> tag to Always (which enables UFT to listen for the mouseover event even though the image does not contain a behavior or event handler). You then set Record option on the image to Enable.

For task details on setting event listening and recording options, see Manage custom Web event recording configurations.