contentDocument Property (Page Objects)

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

Description

Use the contentDocument property to get the DOM document object of a web page. See Accessing DOM document Object.

Declaration

TestObj.contentDocument

Read-Only Property Object
TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section

Applies To

The property is applied to the following object:

View Mode

To view this property in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.

Property Value

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

Remarks

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

Example

The following example shows how you can get the web page title using the DOM document.title property.

JavaScript, JScript

var page = Sys.Browser("firefox").ToUrl("http://smartbear.com");
Log.Message(page.contentDocument.title);

Python

page = Sys.Browser("firefox").ToUrl("http://smartbear.com")
Log.Message(page.contentDocument.title);

VBScript

Set page = Sys.Browser("firefox").ToUrl("http://smartbear.com")
Log.Message page.contentDocument.title

DelphiScript

page := Sys.Browser('firefox').ToUrl('http://smartbear.com');
Log.Message(page.contentDocument.title);

C++Script, C#Script

var page = Sys["Browser"]("firefox")["ToUrl"]("http://smartbear.com");
Log["Message"](page["contentDocument"]["title"]);

See Also

URL Property
Testing Web Applications
Accessing DOM document Object

Highlight search results