Browsers.Count Property

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

Returns the total number of supported browsers that are found on the current computer.

Declaration

Browsers.Count

Read-Only Property Integer

Applies To

The property is applied to the following object:

Property Value

An integer value that specifies the total number of items in the Browsers collection.

Remarks

If your tests uninstall or install browsers during the run, call the Browsers.Refresh method to update the Browsers collection after the installation or uninstallation is over. This should be done before you continue working with the browsers.

Example

The following routine uses the properties and methods of Browsers and BrowserInfo objects to list all installed and supported browsers.

JavaScript, JScript

function ListBrowsers()
{
  var browser;
  
  for (var i=0; i < Browsers.Count; i++)
  {
    browser = Browsers.Item(i);
    Log.Message("Browser " + aqConvert.IntToStr(i) + " : " + browser.Description);
  }
}

Python

def ListBrowsers():
  for i in range (0, Browsers.Count-1):
    browser = Browsers.Item(i); 
    Log.Message("Browser " + aqConvert.IntToStr(i) + " : " + browser.Description);

VBScript

Sub ListBrowsers
  Dim browser
 
  For i = 0 To Browsers.Count-1
    Set browser = Browsers.Item(i)
    Log.Message("Browser " + aqConvert.IntToStr(i) + " : " + browser.Description)
  Next
End Sub

DelphiScript

procedure ListBrowsers;
var
  browser, i : OleVariant;
begin
  for i:=0 to Browsers.Count-1 do 
  begin
    browser := Browsers.Item(i);
    Log.Message('Browser ' + aqConvert.IntToStr(i) + ' : ' + browser.Description);
  end;
end;

C++Script, C#Script

function ListBrowsers()
{
  var browser;
  
  for (var i=0; i < Browsers["Count"]; i++)
  {
    browser = Browsers["Item"](i);
    Log["Message"]("Browser " + aqConvert["IntToStr"](i) + " : " + browser["Description"]);
  }
}

See Also

Browsers Object
Browsers.Item

Highlight search results