Applies to TestComplete 14.10, last modified on June 5, 2019

TestComplete lets you access the HTML DOM document object of web pages. You can use it in your tests to get specific DOM-related data from the web page.

To access a web page’s DOM document object, use the contentDocument property of the Page test object. Similarly, to get the document object of a frame, use the contentDocument property of the Frame test object.

The following example demonstrates how you can use the DOM document.title property to get the web page title:

Keyword test that gets the contentDocument.title property value

JavaScript, JScript

function Test()
  var page = Sys.Browser().Page("");


def Test():
  page = Sys.Browser().Page("");


Sub Test
  Dim page
  Browsers.Item(btIExplorer).Run ""
  Set page = Sys.Browser.Page("")
  Log.Message page.contentDocument.title
End Sub


procedure Test;
var page;
  page := Sys.Browser.Page('');

C++Script, C#Script

function Test()
  var page = Sys["Browser"]()["Page"]("");

For information on the properties and methods of the DOM document object in different browsers, follow these links:


  • The contentDocument property is a native property of web pages in Chrome, Firefox, Edge and Internet Explorer 10 and later.

  • If you use the DOM or Hybrid object model for your web tests, the DOM document object is also available as the Page.document test object. However, working with a native DOM document using the Page.contentDocument property enables you to reuse test snippets across tests that use different web object models.

See Also

Testing Web Applications
Cross-Browser Testing in TestComplete
Common Tasks for Web Testing
Executing JavaScript on Web Pages
Accessing Native Web Attributes and Methods
Getting CSS Attributes

Highlight search results