Recording Window Declarations that Include Locator Keywords

A window declaration specifies a cross-platform, logical name for a GUI object, called the identifier, and maps the identifier to the object’s actual name, called the tag or locator. You can use locator keywords, rather than tags, to create scripts that use dynamic object recognition and window declarations. Or, you can include locators and tags in the same window declaration.

To record window declarations that include locator keywords, you must use the Open Agent.

To record window declarations using the Locator Spy:
  1. Configure the application to set up the technology domain and base state that your application requires.
  2. Click Record > Window Locators. The Locator Spy opens.
  3. Position the mouse over the object that you want to record and perform one of the following steps:
    • Press Ctrl+Alt to capture the object hierarchy with the default Record Break key sequence.
    • Press Ctrl+Shift to capture the object hierarchy if you specified the alternative Record Break key sequence on the General Recording Options page of the Recording Options dialog box.
      Note: For SAP applications, you must set Ctrl+Shift as the shortcut key combination. To change the default setting, click Options > Recorder and then check the OPT_ALTERNATE_RECORD_BREAK check box.
    • If you use Picking mode, click the object that you want to record and press the Record Break keys.
  4. Click Stop Recording Locator.

    The Locator text box displays the XPath query string for the object on which the mouse rests. The Locator Details section lists the hierarchy of objects for the locator that displays in the text box. The hierarchy listed in the Locator Details section is what will be included in the INC file.

  5. To refine the locator, in the Locator Details table, click Show additional locator attributes, right-click an object and then choose Expand subtree. The objects display and any related attributes display in the Locator Attribute table.
  6. To replace the hierarchy that you recorded, select the locator that you want to use as the parent in the Locator Details table. The new locator displays in the Locator text box.
  7. Perform one of the following steps:
    • To add the window declarations to the INC file for the project, position your cursor where you want to add the window declarations in the INC file, and then click Paste Hierarchy to Editor.
    • To copy the window declarations to the Clipboard, click Copy Hierarchy to Clipboard and then paste the window declarations into a different editing window or into the current window at the location of your choice.
  8. Click Close.