Run Method

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

Description

Launches the corresponding browser, and, if a URL was specified as a parameter, navigates to the web page.

Declaration

BrowserInfoObj.Run(URL, PageLoadWaitTime)

BrowserInfoObj An expression, variable or parameter that specifies a reference to a BrowserInfo object
URL [in]    Optional    String Default value: Empty string   
PageLoadWaitTime [in]    Optional    Integer Default value: -1   
Result None

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

URL

The URL of the web page to be opened after the browser starts.

We recommend that you specify the complete URL of the desired page, including the protocol name, page extension, trailing slash and so on. For instance, https://developer.mozilla.org/en-US/. You can copy the complete URL from the browser’s address bar.

PageLoadWaitTime

The time (in milliseconds) to wait until the browser loads the page and becomes ready to accept user input. If PageLoadWaitTime is omitted, the timeout is specified by the project’s Web page loading timeout option. After the specified time limit is reached, the test execution proceeds.

Result Value

None.

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 method (and the BrowserInfo.Navigate method) in your test. As a workaround, you can launch Firefox by using the TestedApp.Run method and navigate to web pages by simulating user actions on the browser's address bar.

  • If the method navigates to a web page successfully, it posts an event message to the test log.

  • If the method cannot navigate to a web page, it fails and posts an error message to the test log.

  • If the specified browser is already running in the system, the method posts a warning message to the test log. For information on how to determine whether a browser is running, see Check if Browser Is Running.

  • If your tests install or uninstall browsers during the run, then you need to update the browser collection before continuing the test. To do this, call the Browsers.Refresh method before launching a browser, navigating to a web page or performing any other browser-related operation after the installation or uninstallation is over.

Example

The following code demonstrates how to launch Internet Explorer and open the Products page of the SmartBear web site:

JavaScript, JScript

function RunIE()
{
  Browsers.Item(btIExplorer).Run("http://smartbear.com/products");
}

Python

def RunIE():
  Browsers.Item[btIExplorer].Run("http://smartbear.com/products");

VBScript

Sub RunIE
  Browsers.Item(btIExplorer).Run("http://smartbear.com/products")
End Sub

DelphiScript

procedure RunIE;
begin
  Browsers.Item(btIExplorer).Run('http://smartbear.com/products');
end;

C++Script, C#Script

function RunIE()
{
  Browsers["Item"](btIExplorer)["Run"]("http://smartbear.com/products");
}

For more examples of using this method, see the following topics:

See Also

BrowserInfo Object
Navigate Method
Launch Web Browsers
Running Tests in Multiple Browsers

Highlight search results