BrowserWindow Method

Applies to TestComplete 15.63, last modified on April 10, 2024


The Browser.BrowserWindow method lets you access an opened browser window as a BrowserWindow test object. You can use this object to manipulate the browser window, for example, maximize it or position it on the screen.

Note: The BrowserWindow method accesses a browser window, not a web page in that window. To access web pages opened in a browser, use the Browser.Page method.
To check if a browser window exists, use the Browser.WaitBrowserWindow method rather than Browser.BrowserWindow. This way you will avoid the “Unable to find the object” error in case the specified browser is not running. For more information, see Checking Whether an Object Exists.



TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
ObjectIdentifier [in]    Required    Integer    
Result A BrowserWindow object

Applies To

The method is applied to the following object:

View Mode

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


The method has the following parameter:


A zero-based index of the browser window among all windows opened in the browser. The first browser window has the index of 0, the second - 1, and so on.

Result Value

A BrowserWindow object corresponding to the specified browser window.


If a browser window with the specified index was not found, the Browser method posts the “Unable to find the object” error to the test log. To avoid the error in case the browser window was not found, use the WaitBrowserWindow method to check if that window currently exists. For more information, see Checking Whether an Object Exists and Waiting for an Object, Process or Window Activation.

If you use Name Mapping, you typically refer to browser windows as Aliases.browser.BrowserWindow, Aliases.browser.BrowserWindow1 and so on, rather than using the Browser.BrowserWindow(ObjectIdentifier) method.


The following example reads the title of a browser window.

JavaScript, JScript

function Test()
  var title = Sys.Browser().BrowserWindow(0).WndCaption;


def Test():
  title = Sys.Browser().BrowserWindow(0).WndCaption


Sub Test
  Dim title

  Call Browsers.Item("iexplore").Run("")
  title = Sys.Browser().BrowserWindow(0).WndCaption
  Call Log.Message(title)
End Sub


procedure Test;
var title;
  title := Sys.Browser().BrowserWindow(0).WndCaption;

C++Script, C#Script

function Test()
  var title = Sys["Browser"]()["BrowserWindow"](0)["WndCaption"];

See Also

BrowserWindow Object
WaitBrowserWindow Method
Classic Web Testing
Understanding Web Object Identification and Object Models

Highlight search results