Applies to TestComplete 14.30, last modified on November 21, 2019
Information in this topic applies to web applications.

The Open Applications > Web Testing > Object Identification options let you configure how TestComplete chooses identifiers for web objects and handles dynamic identifiers. Note that these options are available only if the web testing plugins are installed and enabled in File > Install Extensions.

To view or modify the web object identification options:

  • Select Tools > Current Project Properties from the TestComplete menu.

    – or –

    Double-click the project in the Project Explorer. In the project editor that opens, select the Properties tab.

    – or –

    From the context menu of the project in the Project Explorer, select Edit > Properties.

  • In the tree on the left of the project properties editor, select Open Applications > Web Testing > Object Identification.

Changing these options can break existing tests in the project. Do not change these options unless absolutely necessary.
TestComplete Project Properties - Object Identification

Click the image to enlarge it.

You can change the following options:

  • Identification attribute – In the Tree model, TestComplete uses the HTML id and name attributes to identify web page elements. This option specifies which attribute TestComplete should look at first when selecting an identifier for a web object.

    If the selected primary attribute is not specified or if it is ignored due to matching one of the Dynamic identifiers, TestComplete tries the other attribute. If the secondary attribute is also missing or ignored, TestComplete uses the object index as its identifier. See also the description of the ObjectIdentifier property.

  • Dynamic identifiers – Web applications can use dynamically generated ids (for example, ext-gen-123) that can change from session to session. This option specifies a list of patterns for detecting and handling dynamic identifiers in order to achieve more robust object recognition during test recording and playback. Depending on the pattern type and configuration, TestComplete either ignores the dynamic identifier or extracts and uses its stable, non-changing part. For more information, see Handling Dynamic Identifiers in Web Applications.

    There are predefined patterns for popular web application frameworks, such as ASP.NET, jQuery UI, Ext JS, GWT and others.

    The table with patterns contains the following columns:

    • Description - An arbitrary description of the pattern.

      The check box to the left of the description indicates whether the pattern is enabled for use.

    • Pattern Type - the pattern type which you can select from the drop-down list:

      • Wildcard patterns are simple patterns that specify a string of characters with dynamic parts of the string masked by the * and ? wildcards. An asterisk ( * ) matches any sequence of characters (including an empty string), a question mark ( ? ) - any single character.

        A match occurs only if the entire identifier matches the specified pattern.

        Wildcard patterns denote dynamic identifiers that TestComplete should ignore completely. If an object identifier matches a wildcard pattern, TestComplete ignores it and chooses another suitable identifier.

      • Regular expressions (RegExp) allow you to define complex matching patterns with optional items, alternations, repetitions and other rules. For more information, see Regular Expressions Syntax.

        A dynamic identifier matches against a regular expression pattern if the pattern appears anywhere in the identifier. However, if the pattern includes the “beginning of input” (^), “end of input” ($) or both tokens, a match occurs only if the identifier starts with, ends with or entirely matches the specified regular expression.

        If the dynamic identifier includes non-changing parts (such as treepicker in treepicker-1038), you can denote them using capturing parentheses { } within the regular expression. After that you can specify the Stable ID Template to construct the object identifier to be used by TestComplete from the captured sub-expressions (see below).

        If the Stable ID Template is not specified for a regular expression pattern, TestComplete will ignore identifiers that match this pattern and choose other suitable identifiers for the web objects.

    • ID Pattern - The pattern used to determine if an identifier is dynamic. Patterns are case-sensitive.

    • Stable ID Template - Used only with regular expression patterns. Specifies a template to create a stable identifier for the object from non-changing parts of the dynamic identifier. These parts must be enclosed in the capturing parentheses { } within the ID Pattern. In the Stable ID Template, use $1, $2 and so on to refer to the first, second, etc. captured sub-expressions within regular expressions.

    The pattern order in the table corresponds to the order in which TestComplete checks these patterns against web object identifiers. To change the priority of patterns, use the Move Up and Move Down buttons.

    To instruct TestComplete not to use a specific pattern, unselect the check box to the left of the pattern description.

    To add a new group

    Click Add group and enter the group name. The group will be appended at the end of the table.

    Add custom patterns and pattern groups only at the end of the list.
    To add a new pattern via wizard

    TestComplete includes the Add Dynamic Identifier Pattern wizard that automatically generates a match pattern for any given identifier. To add a pattern using this wizard:

    • Select the group to add the pattern to and click Add.

    • Follow the steps in the wizard to specify the dynamic identifier and review the generated pattern.

    The pattern will be appended at the end of the group. You can modify it if necessary by changing the pattern data in the table.

    To define a pattern manually

    If you already have a regular expression or wildcard pattern, you can enter it directly into the table:

    • Select the group to add a pattern to and click Add Item. A new item will be appended at the end of the group.

    • Specify the pattern, pattern type and description.

    • Select the Enable check box to activate the pattern.

    To modify a pattern
    • Click on a value in the table twice (not double-click).

    • Enter the new value and press Enter.

    To check if a specific identifier matches one of the existing patterns
    • Click Test. This will open the Test Dynamic Identifier Patterns wizard.

    • In the wizard, enter the identifier you want to test or point to a web page element with this identifier.

      Note: The identifier used by TestComplete is either the HTML id or name attribute of web objects, according to the Identification attribute setting.

    If the specified identifier matches any of the existing patterns, the wizard will show the pattern description and the stable identifier extracted from this identifier (if any).

    To enable or disable a pattern

    Select or unselect the check box to the left of the pattern description.

    To delete a pattern or group

    Select the pattern or group and click Remove.

    Tip: Instead of deleting patterns, you can uncheck them in the table. The pattern definition remains in the project, but TestComplete will not use it.

The default values for the web object identification options that will be used in new TestComplete projects can be specified in the Default Project Properties - Object Identification Options dialog.

See Also

Testing Web Applications
Handling Dynamic Identifiers in Web Applications
Default Project Properties - General Web Testing Options
Project Properties

Highlight search results