Naming Web Objects

Applies to TestComplete 15.63, last modified on April 23, 2024

When you create tests for web pages and web applications, you access web elements as separate objects. The way you address individual web elements in tests depends on the following:

  • Whether you use Name Mapping in your tests. If you do, you can assign custom short names for your tested web elements and specify search criteria that TestComplete will use to locate those objects on the web page.

    For TestComplete 14.50: Which search criteria are used depends on whether your current TestComplete test project is configured to rely on XPath expressions and CSS selectors or on identification properties provided by TestComplete (for example, idStr).

    Addressing objects when Name Mapping is used and the project is configured to use identification properties to locate web objects

    Click the image to enlarge it.

    The project is configured to use identification properties to locate web objects

    Addressing objects when Name Mapping is used and the project is configured to use XPath expressions and CSS selectors to locate web objects

    Click the image to enlarge it.

    The project is configured to use XPath expressions and CSS selectors to locate web objects

  • If you do not use Name Mapping in your tests, you can address web elements by their full name in the object hierarchy (the FullName property that you can view in the Object Browser or Object Spy). Depending on whether your project is configured to use XPath expressions and CSS selectors to locate web objects, the FullName property will either use the FindElement method or include the full hierarchy of the web element in the object tree.

    Addressing objects by its FullName and the project is configured to use identification properties to locate web objects

    Click the image to enlarge it.

    The project is configured to use identification properties to locate web objects

    Addressing objects by its FullName and the project is configured to use XPath expressions and CSS selectors to locate web objects

    Click the image to enlarge it.

    The project is configured to use XPath expressions and CSS selectors to locate web objects

See Also

Object Browser Naming Notation
About Object Browser Naming Notation
Tree Model
Name Mapping
Classic Web Testing

Highlight search results