Updating Object Maps from the Test Application

If items in the test application change, you can use the Object Map UI to update the locators for these items.

  1. In the Solution Explorer, click on the Object Maps folder of the project in which the object map that you want to change is located.
  2. Choose one of the following:
    • Double-click the object map that you want to use.
    • Right-click the object map that you want to use and choose Open.
    The object map displays a hierarchy of the object map items and the locator associated with each item.
  3. Click Update Locator. The Locator Spy displays and Silk4NET opens the test application.
  4. Position the mouse cursor over the object that you want to record and press CTRL+ALT. Silk4NET displays the locator string in the Locator text field.
  5. Select the locator that you want to use in the Locator Details table.
  6. Remove any attributes that you do not want to use from the locator that is displayed in the Locator text field.
  7. Click Validate Locator to validate that the locator works.
  8. Click Paste Locator to Editor to update the locator in the object map.
  9. Save the changed object map.
When you update an object map item from the AUT, you can change only the XPath representations of leaf nodes in the object map tree. You cannot change the XPath representations of any parent nodes. When the XPath representations of higher-level nodesin the object map tree are not consistent after the update, an error message displays.

Example

For example, suppose you have an object map item with an object map ID that has the following three hierarchy levels:
WebBrowser.Dialog.Cancel
The corresponding XPath representation of these hierarchy levels is the following:
 /BrowserApplication//Dialog//PushButton[@caption='Cancel']
  • First hierarchy level: /BrowserApplication
  • Second hierarchy level: //Dialog
  • Third hierarchy level: //PushButton[@caption='Cancel']
You can use the following locator to update the object map item:
 /BrowserApplication//Dialog//PushButton[@id='123']
  • First hierarchy level: /BrowserApplication
  • Second hierarchy level: //Dialog
  • Third hierarchy level: //PushButton[@id='123']
You cannot use the following locator cannot to update the object map item, because the second level hierarchy nodes do not match:
 /BrowserApplication//BrowserWindow//PushButton[@id='9999999']
  • First hierarchy level: /BrowserApplication
  • Second hierarchy level: //BrowserWindow
  • Third hierarchy level: //PushButton[@id='9999999']