contentDocument Property (Page Objects)

Applies to TestComplete 15.70, last modified on December 17, 2024

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 11.

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
Classic Web Testing
Accessing DOM document Object

Highlight search results