Modifying a Locator in an Object Map

Locators are automatically associated with an object map item when you record a visual test or script. However, you might want to modify a locator path to make it more generic. For example, if your test application automatically assigns the date or time to a specific control, you might want to modify the locator for that control to use a wildcard. Using a wildcard enables you to use the same locator for each test even though each test inserts a different date or time.

  1. Choose View > Asset Browser or select Get Started > Asset Browser in the Start Screen.
  2. From the Asset Types list, select Object Map. Any existing object maps for the selected project display in the right pane.
    Tip: If you do not see the object map that you want to edit, ensure that the correct project is selected in the Active Project list.
  3. Choose one of the following:
    • Double-click the object map that includes the locator that you want to modify.
    • Right-click the object map that includes the locator that you want to modify and choose Open.
    The object map displays a hierarchy of the object map items and the locator associated with each item.
    Note: If another user is currently editing the object map that you select, a message box notifies you and names the user who currently has the object map locked.
  4. Click Edit. By default, the object map is read only. Clicking Edit gives you read/write access and ensures that no other users can edit the entries while you are modifying them. You can also press F2 to edit the currently selected field in the object map. The Edit button changes to Revert. If you want to undo any changes that you make during this session, click Revert.
  5. Navigate to the locator that you want to modify. For example, you might need to expand a node to locate the locator that you want to modify.
  6. Click the locator path that you want to modify and then click the locator path again or click F2. Once you access in-line editing mode, you can click a locator path one time to edit it. Press Tab to toggle between the name and the description of the object map item. A black box displays around the locator path field and the text is highlighted.
  7. If you have a valid locator path, you can type the item name and locator path that you want to use and then press Enter. To determine a valid locator path, use the Identify Object dialog box as described in the following steps:
    1. Choose Tools > Identify Object.
      The Select Application dialog box might open if the test application has not been associated with the object map. If this happens, select the application that you want to test and then click OK. The Identify Object dialog box opens.
    2. Specify the Selection mode.
      • Click – Click the object to identify the locator.
      • Hot Key – Specify this mode to capture the object using the keystroke combination specified in the Keystroke list box. Typically, you choose this mode to capture objects, such as a menu or combobox, that only appear when clicked by the user. With this mode, you select the object and then press the hot key keystroke combination to capture the locator without dismissing the object.
    3. Click Start Identify.
    4. Position the mouse over the object that you want to record and perform one of the following steps:
      • If you use Click mode, click the object that you want to identify.
      • Press the keystroke combination to capture the object with the Hot Key mode.

        By default, the keystroke combination is Ctrl+Shift.

      Silk Test Workbench lists the related locator string in the Selected Locator text box.
    5. Select the locator that you want to use in the Locator Details table. The new locator displays in the Selected Locator text box.
    6. Click Paste. Silk Test Workbench adds an item name and the associated locator to the object map.
  8. If necessary, modify the item name or locator text to meet your needs. If you use an invalid character or locator, the item name or locator text displays in red and a tooltip explains the error.

    Invalid characters for object map items include: \, /, <, >, ", :, *, ?, |, =, ., @, [, ].

    Invalid locator paths include: empty or incomplete locator paths.

  9. Perform one of the following steps:
    • Click Save to save your changes and continue working on the object map.

      Silk Test Workbench saves your changes as a new version and the object map mode goes back to read only.

    • Click Save and close to save your changes and exit the object map.

      Silk Test Workbench saves your changes as a new version and the object map is available for other users to modify.

If any existing visual tests or scripts use the locator path that you modified, you must manually change the visual tests or scripts to use the new locator path.