VirtualBrowsers.Count Property

Applies to TestComplete 14.70, last modified on April 22, 2021

Description

The VirtualBrowsers.Count property returns the total number of mobile browser profiles available for use in tests. Mobile browser profiles are defined in the project’s Open Applications | Web Testing | Virtual Browsers properties. VirtualBrowsers.Count includes only the enabled profiles (those that are checked in the table).

Declaration

VirtualBrowsers.Count

Read-Only Property Integer

Applies To

The property is applied to the following object:

Property Value

An integer value that indicates the total number of enabled mobile browser profiles.

Example

This line posts the number of enabled mobile browser profiles to the test log:

JavaScript, JScript

Log.Message("Total number of mobile browser profiles: " + VirtualBrowsers.Count);

Python

Log.Message("Total number of mobile browser profiles: " + AqConvert.VarToStr(VirtualBrowsers.Count));

VBScript

Call Log.Message("Total number of mobile browser profiles: " & VirtualBrowsers.Count)

DelphiScript

Log.Message('Total number of mobile browser profiles: ' + VarToStr(VirtualBrowsers.Count));

C++Script, C#Script

Log["Message"]("Total number of mobile browser profiles: " + VirtualBrowsers["Count"]);

The following examples launches the mobile browser emulator with all available browser profiles in a loop.

JavaScript, JScript

function Test()
{
  for (var i = 0; i < VirtualBrowsers.Count; i++)
  {
    VirtualBrowsers.Item(i).Run("http://m.smartbear.com");
    Sys.Browser().Close();
  }
}

Python

def Test():
  for i in range (0, VirtualBrowsers.Count):
    VirtualBrowsers.Item[i].Run("http://m.smartbear.com")
    Sys.Browser().Close()

VBScript

Sub Test
  Dim i

  For i = 0 To VirtualBrowsers.Count - 1
    Call VirtualBrowsers.Item(i).Run("http://m.smartbear.com")
    Sys.Browser.Close
  Next
End Sub

DelphiScript

procedure Test;
var i;
begin
  for i := 0 to VirtualBrowsers.Count - 1 do
  begin
    VirtualBrowsers.Item[i].Run('http://m.smartbear.com');
    Sys.Browser.Close;
  end;
end;

C++Script, C#Script

function Test()
{
  for (var i = 0; i < VirtualBrowsers["Count"]; i++)
  {
    VirtualBrowsers["Item"](i)["Run"]("http://m.smartbear.com");
    Sys["Browser"]()["Close"]();
  }
}

See Also

Testing Mobile Web Applications Using Emulator
VirtualBrowsers Object
VirtualBrowsers.Item
VirtualBrowsers.CurrentBrowser

Highlight search results