The structure of web-elements representation in Object Browser depends on the project setting Web Tree Model. This setting affects the way that web elements are displayed in Object Browser and accessed from scripts.
In this recipe we will consider the available web application models.
To change the Web Tree Model settings, it is necessary to perform the following actions:
TestComplete supports the following models for web applications:
Tree
is being used, the hierarchy of control elements in Object Browser corresponds with that of the application. The Tree
is the only model with cross-browser testing support.document.all
element. If the page contains frames, they can be accessed via the document.frames
object, similarly to the way they are represented in the DOM model of the webpages.HTML
, BODY
, and so on) do not have sibling elements; rather they directly correspond to the eponymous page elements.Tree
and DOM
that is meant for creation of the new scripts with the use of the recommended Tree
model, simultaneously lending support for the older scripts which utilized the DOM
model:If you are not content with the recommended Tree
model, you can try using other models; however, the cross-browser TestComplete testing possibilities will not be available.
If you have some older scripts, written with the help of the Tag
model, and you're willing to write some new ones using the recommended Tree
model, you could dynamically signify which model to use for each of the tests. An instance of dynamically changing the objects model from script is shown in the following code snippet:
Options.Web.TreeModel = "Tag" Options.Web.TreeModel = "Tree"