Configuring the Locator Generator for xBrowser

The Open Agent includes a sophisticated locator generator mechanism that guarantees locators are unique at the time of recording and are easy to maintain. Depending on your application and the frameworks that you use, you might want to modify the default settings to achieve the best results.

A well-defined locator relies on attributes that change infrequently and therefore requires less maintenance. Using a custom attribute is more reliable than other attributes like caption or index, since a caption will change when you translate the application into another language, and the index might change when another object is added.

To achieve optimal results, add a custom automation ID to the elements that you want to interact with in your test. In Web applications, you can add an attribute to the element that you want to interact with, such as <div myAutomationId=”my unique element name” />. This approach can eliminate the maintenance associated with locator changes.

  1. Click Silk4J > Edit Options and then click the Custom Attributes tab.
  2. If you use custom automation IDs, from the Select a TechDomain list box, select xBrowser and then add the IDs to the list. The custom attributes list contains attributes that are suitable for locators. If custom attributes are available, the locator generator uses these attributes before any other attribute. The order of the list also represents the priority in which the attributes are used by the locator generator. If the attributes that you specify are not available for the objects that you select, Silk4J uses the default attributes for xBrowser.
  3. Click the Browser tab.
  4. In the Locator attribute name exclude list grid, type the attribute names to ignore while recording.

    For example, use this list to specify attributes that change frequently, such as size, width, height, and style. You can include the wildcards ‘*’ and ‘?’ in the Locator attribute name exclude list.

    Separate attribute names with a comma.

  5. In the Locator attribute value exclude list grid, type the attribute values to ignore while recording.

    Some AJAX frameworks generate attribute values that change every time the page is reloaded. Use this list to ignore such values. You can also use wildcards in this list.

    Separate attribute values with a comma.

  6. Click OK.

    You can now record or manually create a test case.