Run Browser Operation

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

Description

You use the Run Browser operation in keyword tests to launch one of the supported web browsers and open a tested web page in it.

Note: In web tests that you run in cloud environments, this operation is ignored. To run browsers in such tests, assign the target browser to the test in the execution plan of your project or use the Run Remote Browser operation.

Requirements

A license for the TestComplete Web module.

Operation Result

The operation launches the specified web browser and navigates to the specified web page in it. The operation does not return any value:

  • If the operation is executed successfully, it posts an event message () to the test log and makes the launched browser the current browser for the test. All browser-related operations that follow the operation will interact with the current browser. To check if the web browser has been launched, you can use the If Object operation to check if the target browser exists in the system. See Check if Browser Is Running.

  • If the specified browser is already running, the operation will post a warning message () to the test log.

  • If the specified browser is not installed or if the operation fails to navigate to the specified web page, it will fail and post an error message () to the test log.

Scripting Analogue

In script tests, you can launch a web browser and open a tested web page in it with the Browsers.Item(…).Run method.

Child Operations

The operation cannot have child operations.

Operation Parameters

When you add the operation to a keyword test, TestComplete shows a wizard in which you can specify the operation parameters:

Select Browser

On this page, select one of the supported browsers that the operation will launch. The operation will launch the latest supported version of the selected browser that is installed on the computer where the test will run.

The operation can run only browsers supported by TestComplete (see Supported Web Browsers and Technologies). If you specify an unsupported browser, the operation will post an error message to the log.

To specify a browser version or edition to run, select Parameterize and specify the browser details on the next page of the wizard.

Browser Selection Parameters

If you have selected Parameterize on the previous page of the wizard, specify the following parameters:

Browser

Required. A string or integer value that specifies the browser to be launched. You can either choose the browser from the drop-down list or specify a constant, test parameter, project variable or code expression that returns one of the following values:

String Value Constant Integer Value
Internet Explorer btIExplorer -1
Firefox btFirefox -2
Chrome btChrome -3
Edge btEdge -6

For information on various methods for specifying parameter values, see Specifying Operation Parameters.

Version

Optional. Specifies the browser version number you would like to use.

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 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 on your computer.

Platform

Specifies which browser version you would like to run: 32-bit or 64-bit. You can either choose the platform from the drop-down list or specify a constant, test parameter, project variable or code expression that returns one of the following values:

Constant Integer Value Description
pX86 0 32-bit edition of the browser.
pX64 1 64-bit edition of the browser.
pAny -1 Any available version of the browser.

If you have both 32- and 64-bit versions, the 32-bit version will be used.

For information on various methods for specifying parameter values, see Specifying Operation Parameters.

Operation Parameters

On this page you can specify the following parameters:

Url

Specifies the URL of the web page that will be opened by the browser after it is launched.

PageLoadWaitTime

Specifies the time (in milliseconds) to wait until the browser loads the page and becomes ready to accept user input. If this parameter is omitted or set to -1 (the default value), the timeout is specified by the project's Web page loading timeout option. After the specified time limit is reached, the test execution proceeds.

Example

The image below shows a keyword test that runs a web browser and simulates user actions over a web page in it:

Running a web browser in a keyword test

Click the image to enlarge it.

Remarks

  • To improve the Firefox performance, the method automatically configures some Firefox settings before launching the web browser.
    These settings will not be restored to their initial values after the test run is over.

    To prevent TestComplete from modifying your Firefox settings, do not use the Run Browser operation (and the Navigate operation) in your test. As a workaround, you can launch Firefox by using the Run TestedApp operation and navigate to web pages by simulating user actions on the browser's address bar.

  • If your tests uninstall or install a browser during the run, call the Browsers.Refresh method before the first test command that navigates to a web page, launches a browser or performs any other browser-related operation after the installation or uninstallation is over.

  • For information on various methods that can be used for setting operation parameters, see Specifying Operation Parameters.

See Also

Web Category
Navigate Operation
If Browser Operation
Specifying Operation Parameters
Checking Operation Result
Run TestedApp Operation
Classic Web Testing

Highlight search results