Web Elements Included in and Excluded From the Tree Model

Applies to TestComplete 12.60, last modified on September 17, 2018

A web page’s markup can contain a large number of nested elements. For simplicity, the Tree model does not include some elements in the hierarchy. For example, it does not include intermediate container elements that do not have any text content.

The following list describes how web objects are filtered in the Object Browser:

  • Elements with the following tag names are always included in the Tree object model in the Object Browser:

    A
    BUTTON
    CAPTION
    DIV
    EMBED
    FIELDSET
    FORM
    IFRAME
    IMG
    LABEL
    LEGEND
    MARQUEE
    OBJECT
    SELECT
    TABLE
    TD
    TH
    TEXTAREA
  • The following elements are not included in the Tree object model:

    • Child OPTION elements of SELECT elements

    • Hidden INPUT fields: <input type="hidden">

    • SCRIPT, STYLE elements and comments

  • Other elements are included in the Tree object model if they have any of the following:

    • text contents (in the element, not in its child elements)

    • a role other than presentation

    Consider the following examples:

    HTML Example Description

    <span id="placeholder" role="button">
      <span id="text">Add Item</span>
    </span>

    The object tree includes test objects for both SPAN elements. The parent SPAN element is included because even though it has no text contents, it has a non-presentation role.

    <span id="placeholder">
      <span id="text">Add Item</span>
    </span>

    Only the nested SPAN element is included in the object tree. The parent SPAN element is not included because it has neither text contents of its own nor a non-presentation role.

    Note: If the Use legacy web testing features project option is enabled, SPAN elements with no text contents of their own are not included in the Tree object model regardless of their role attribute.

The web object structure in Name Mapping matches the object structure in the Object Browser. However, if the objects are mapped while the Use extended find when possible option is enabled, Name Mapping does not include web page layout containers, such as DIVs and TABLEs, which are not used for identification of tested web objects.

See Also

Testing Web Applications
About Web Object Identification and Object Models
Web Object Types Used by the Tree Model and Hybrid Mobile Applications
DOM Model
Tag Model
Hybrid Model
Accessing DOM document Object

Highlight search results