Version Property

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

Description

Returns the browser’s version information.

Declaration

BrowserInfoObj.Version

Read-Only Property FileVersionInfo object or String
BrowserInfoObj An expression, variable or parameter that specifies a reference to a BrowserInfo object

Applies To

The property is applied to the following object:

Property Value

This property can have two possible types of return value: an object and a string.

Generally, it returns the FileVersionInfo object, however, in cases when a string value is expected, it returns a string representation of an object.

When a string is returned, if has the following format: major_number.minor_number.build_number.private_number.

Example

The code below outputs the version of the Internet Explore browser installed on the current computer.

JavaScript, JScript

function ShowIEVersion()
{
  Log.Message("Internet Explorer version: "+Browsers.Item(btIExplorer).Version);
}

Python

def ShowIEVersion():
  Log.Message("Internet Explorer version: " + aqConvert.VarToStr(Browsers.Item[btIExplorer].Version));

VBScript

Sub ShowIEVersion
  Log.Message("Internet Explorer version: "+Browsers.Item(btIExplorer).Version)
End Sub

DelphiScript

procedure ShowIEVersion;
begin
  Log.Message('Internet Explorer version: '+Browsers.Item(btIExplorer).Version);
end;

C++Script, C#Script

function ShowIEVersion()
{
  Log["Message"]("Internet Explorer version: "+Browsers["Item"](btIExplorer)["Version"]);
}

The following code displays a warning message when the test starts running in Internet Explorer 10 or earlier:

JavaScript, JScript

function CheckIEVer()
{
  ...
  if ((Browsers.CurrentBrowser.Family == btIExplorer) &&
      (Browsers.CurrentBrowser.Version.MajorPart < 11))
    Log.Warning("You are using an outdated version of Internet Explorer.")
  ...
}

Python

def CheckIEVer():
  # ...
  if ((Browsers.CurrentBrowser.Family == btIExplorer) and 
      (Browsers.CurrentBrowser.Version.MajorPart < 11)):
    Log.Warning("You are using an outdated version of Internet Explorer.");
  # ...

VBScript

Sub CheckIEVer
  ...
  If Browsers.CurrentBrowser.Family = btIExplorer Then
    If Browsers.CurrentBrowser.Version.MajorPart < 11 Then
      Log.Warning("You are using an outdated version of Internet Explorer.")
    End If
  End If
...
End Sub

DelphiScript

procedure CheckIEVer;
begin
  ..
  if (Browsers.CurrentBrowser.Family = btIExplorer) and
     (Browsers.CurrentBrowser.Version.MajorPart < 11) then
    Log.Warning('You are using an outdated version of Internet Explorer.');
  ...
end;

C++Script, C#Script

function CheckIEVer()
{
  ...
  if ((Browsers["CurrentBrowser"]["Family"] == btIExplorer) &&
      (Browsers["CurrentBrowser"]["Version"]["MajorPart"] < 11))
    Log["Warning"]("You are using an outdated version of Internet Explorer.")
  ...
}

See Also

BrowserInfo Object

Highlight search results