If Browser Operation

Applies to TestComplete 15.62, last modified on March 19, 2024

Description

You use the If Browser operation in your web tests to check the web browser that is currently used by the test. You may need to know this if your test contains some browser-specific operations which should be executed or skipped depending on the web browser that the test is using.

Requirements

A license for TestComplete Web module.

Operation Result

If the current browser matches the browser specified by the operation parameters, the operation’s result value is True. Otherwise, its result is False.

Scripting Analogue

To obtain and compare information about the current browser in scripts, use the Browsers.CurrentBrowser property. For more information, see Checking the Current Browser.

Child Operations

The operation can have any other operation (or operations) as a child. The test executes them if the current web browser matches the browser specified by the operation parameters.

For information on how to make an operation a child of another operation, see the description of the Keyword Test editor’s Test Steps page.

Operation Parameters

When you add the operation to your keyword test, TestComplete displays a wizard that contains the following pages.

Select Browser

On this page you can choose the browser family to be checked:

  • Internet Explorer

  • Firefox

  • Chrome

If you want to clarify the browser version to be checked (for instance, if you need a specific version or a 32-bit or 64-bit edition), click Next. You will be able to specify the version details on the next page of the wizard.

Specify Browser Parameters

On this page, you can specify additional parameters for the browser that you chose on the Select Browser page. The page contains the following parameters:

Version

Optional. Specifies the browser version to be checked.

You can specify the version in various numeric formats: major version only, major + minor version, major + minor + build number. Literal characters are not taken into account. Below are some examples that are valid for Internet Explorer 11:

  • 11
  • 11.0
  • 11.0.165
  • 11.535.18362

It is recommended that only the major version be specified. When specifying a minor version and build number, check whether you entered correct values. A misprint in one of the digits will cause the operation to fail, as it will not be able to find the specified browser.

Platform

Specifies which browser edition will be checked: a 32-bit or a 64-bit one.

See Also

Web Category
Checking the Current Browser
Working With the Test Steps Page
Checking Operation Result
About Cross-Browser Testing in TestComplete

Highlight search results