Recording an Object Map Item or a Locator Manually For a Script

Before you begin, ensure that the application that you want to test is running.

Manually capture an object map item or a locator using the Identify Object dialog box. Using the Identify Object dialog box enables you to identify objects that you want to test with ease and certainty.

  1. Open the script in which you want to include the object and click the place within the script where you want to insert the object.
  2. Choose Tools > Identify Object.
    The Identify Object dialog box opens.
  3. 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.
  4. Click Start Identify.
    If you want to capture an object map item or a locator in Google Chrome, Silk Test Workbench detects if the selected instance of Google Chrome is started with the appropriate automation parameters, and if not, Silk Test Workbench closes Google Chrome and restarts it with the automation parameters set.
  5. Optional: To bring the application under test into the appropriate state before recording a locator, click Stop Identify. The actions that you perform in the application under test are no longer recorded. To continue with the recording of a locator, click Start Identify.
  6. 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.
  7. To refine how locators display in the Locator Details table, perform any of the following actions:
    • Hide Locator Details – To hide the Locator Details table, click this link.
    • Show object map namesCheck this check box to display object map item names in the Locator column. Object map item names associate a logical name (an alias) with a control or a window, rather than the control or window's locator. By default, object map item names are displayed. To use locators, uncheck this check box.
    • Show full locatorsCheck this check box to display the full locator name. To show only the attribute associated with the object, uncheck this check box.
    • Show propertiesCheck this check box to display any attributes and attribute values for the object selected in the Locator Details table. You can select attributes in this table to use in the locator identification. To hide the Properties subtree and display only locator details, uncheck this check box.
  8. To test that the object that displays in the Selected Locator text box is the object that you want to use, click Test. Silk Test Workbench highlights the object that corresponds with the locator in the application that you want to test.
  9. To replace the locator that you recorded, select the locator that you want to use in the Locator Details table. The new locator displays in the Selected Locator text box.
  10. To copy the locator to the script, click Paste. Silk Test Workbench adds the locator to the script.
  11. Modify the locator to compile correctly in the script and include the action that you want to perform. For instance, you can paste the following full locator into the script:
    /WPFWindow[@caption='Basic Controls'][1]//WPFRichTextBox[@automationId='editableTextBox']
    If the With statement already includes the /WPFWindow declaration, modify the script to use the following locator followed by a method:
    .WPFRichTextBox("@automationId='editableTextBox'").Select(1,10)