Applies to TestComplete 14.70, last modified on October 26, 2020


The ToUrl method opens the page specified by the URL parameter in the web browser and returns the Page program object that corresponds to the new page. You can use the Exists property to determine if the new page was loaded successfully.



TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
URL [in]    Required    String    
WaitTime [in]    Optional    Integer Default value: -1   
Result A Page object

Applies To

The method is applied to the following object:

View Mode

This method is available in the Object Browser panel and in other panels and dialogs in both Basic and Advanced view modes.


The method has the following parameters:


The URL to navigate to. It is recommended to specify the protocol in the URL. Otherwise, the page might not be loaded. For example, use rather than

If the tested web page is located on your computer, then to make your script computer-independent, use the server name rather than localhost when specifying the page’s URL, that is, for instance, use the URL http://mycomp/path/mypage.htm rather than http://localhost/path/mypage.htm. See Computer-Specific Settings for more information about this.


Specifies the time (in milliseconds) to wait until the browser loads the page and becomes ready to accept user input. If WaitTime 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

A Page object that represents the new web page.


  • To determine whether the specified web page has loaded completely, TestComplete uses the following techniques:

    The described mechanism of determining whether a web page has been downloaded completely is acceptable only for static web pages and is not effective for pages with dynamic content. For more information, see Wait For Web Pages and Waiting for Web Pages in Hybrid Mobile Applications.

  • The ToURL method uses two waiting periods:

    • First, the method waits for the web page to load for the timeout period specified by the WaitTime parameter and stops waiting when it determines that the page has been loaded completely or after the timeout elapses.

      The method also stops waiting if the loaded page displays a login dialog. In this case, you need to create test commands that simulate user actions over the dialog to closes it.

    • After the method stops waiting for the page to be loaded, it waits for the time specified by the Auto-wait timeout setting until the object hierarchy contains the desired Page object.

  • When recording actions that open a web page, TestComplete automatically transforms them into the appropriate calls of the ToUrl method. However, a method call is not inserted into the test, unless some other actions (mouse clicks, keyboard input, checkpoints, etc.) are performed over the opened page.

  • To load web pages in a browser, you can also use the Browsers.CurrentBrowser.Navigate or Browser.ToUrl method.

  • ToURL automatically sets the zoom ratio of the destination page to 100%.

  • If User Account Control (UAC) is enabled on your computer, the Page object corresponding to the current web page opened in Internet Explorer is destroyed if the ToURL method navigates to a page that belongs to another domain. Then, a new Page object that corresponds to a target page in Internet Explorer is created. If you face any issues caused by this behavior, you can do the following:


The following example opens a new page and checks whether it has loaded successfully.

JavaScript, JScript

var NewPage = Page.ToUrl("");
if (! NewPage.Exists)
  // Error!


NewPage = Page.ToUrl("")
if not NewPage.Exists:
  # Error!
  Log.Error("Texty text.")


Set NewPage = Page.ToUrl("")
If Not NewPage.Exists Then
  ' Error!
End If


NewPage := Page.ToUrl('');
if not NewPage.Exists then
  // Error!

C++Script, C#Script

var NewPage = Page["ToUrl"]("");
if (! NewPage["Exists"])
  // Error!

See Also

Default Web Testing
Navigate Method
ToUrl Method (Browser Objects)
URL Property (Page Objects)
Navigate to Web Pages
Testing Hybrid Mobile Applications

Highlight search results