Wednesday, July 25, 2007

Setting GUI Recording Options

GUI recording options provide instructions to Robot about how to record and generate GUI scripts. You can set these options either before you begin recording or early in the recording process.

To set the GUI recording options:
  1. Open the GUI Record Options dialog box by doing one of the following:
    • Before you start recording, click Tools > GUI Record Options.
    • Start recording by clicking the Record GUI Script button on the toolbar. In the Record GUI dialog box, click Options.

  2. Set the options on each tab.
  3. Click OK.

Naming Scripts Automatically

Robot can assist you in assigning names to scripts with its script autonaming feature. Autonaming inserts your specified characters into the Name box of a new script and appends a consecutive number to the prefix.

This is a useful feature if you are recording a series of related scripts and want to identify their relationship through the prefix in their names. For example, if you are testing the menus in a Visual Basic application, you might want to have every script name start with VBMenu.

To turn on script autonaming:
  1. Open the GUI Record Options dialog box.
  2. In the General tab, type a prefix in the Prefix box. Clear the box if you do not want a prefix. If the box is cleared, you need to type a name each time you record a new script.
  3. Click OK or change other options.

The next time you record a new script, the prefix and a number appear in the Name box of the Record GUI dialog box.

For example the autonaming prefix is Test. When you record a new script, Test7 appears in the Name box because six other scripts begin with Test.

If you change the script autonaming prefix by clicking Options in the Record GUI dialog box, changing the prefix, and then clicking OK, the name in the Name box changes immediately.

Controlling How Robot Responds to Unknown Objects

During recording, Robot recognizes all standard Windows GUI objects that you click, such as check boxes and list boxes. Each of these objects is associated with one of a fixed list of object types. The association of an object with an object type is generally based on the class name of the window associated with the object.

Robot also recognizes many custom objects defined by IDEs that Robot supports, such as Visual Basic, Oracle Forms, Java, and HTML. For example, if you click a Visual Basic check box, Robot recognizes it as a standard Windows check box. This mapping is based on the object’s Visual Basic assigned class name of ThunderCheckBox.

These built-in object mappings are delivered with Robot and are available to all users no matter which project they are using. During recording, you might click an object that Robot does not recognize. In this case, Robot’s behavior is controlled by a recording option that you set. You can have Robot do either of the following:

  • Open the Define Object dialog box, so that you can map the object to a known object type.
    Mapping an object to an object type permanently associates the class name of the object’s window with that object type, so that other objects of that type are recognized.
  • Automatically map unknown objects encountered while recording with the Generic object type. This permanently associates the class name of the unknown object’s window with the Generic object type.

This is a useful setting if you are testing an application that was written in an IDE for which Robot does not have special support and which therefore might contain many unknown objects. When an object is mapped to the Generic object type, Robot can test a basic set of its properties, but it cannot test the special properties associated with a specific object type. Robot also records the object’s x,y coordinates instead of using the more reliable object recognition methods to
identify the object.

These custom object mappings are stored in the project that was active when the mappings were created.

To control how Robot behaves when it encounters an unknown object during recording:

  1. Open the GUI Record Options dialog box.
  2. In the General tab, do one of the following:
    • Select Define unknown objects as type "Generic" to have Robot automatically associate unknown objects encountered while recording with the Generic object type.
    • Clear Define unknown objects as type "Generic" to have Robot suspend recording and open the Define Object dialog box if it encounters an unknown object during recording. Use this dialog box to associate the object with an object type.
  3. Click OK or change other options.