Applies to TestComplete 14.30, last modified on November 21, 2019

Description

The ToUrl method loads a page specified by the URL parameter in the browser and returns the Page object that corresponds to the loaded page.

Declaration

TestObj.ToUrl(URLWaitTime)

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

To view this method in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.

Parameters

The method has the following parameters:

URL

The URL to navigate to. It is recommended that you specify the protocol in the URL, otherwise the page may not be loaded. For example, use http://www.example.com rather than www.example.com.

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.

WaitTime

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 corresponds to the newly loaded web page.

Remarks

  • 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.

  • The Browser.ToUrl method is an analogue of the Page.ToUrl method. However, it lets you load web pages in a browser without having to obtain the Page object that provides access to web pages.

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

  • When recording actions that open a web page, TestComplete automatically transforms them into the appropriate calls to 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.

Example

To view an example that demonstrates how to use the ToURL method, see Navigating to Web Pages.

See Also

Testing Web Applications
Page Object
WaitPage Method (Process Objects)
ToUrl Method (Window Objects)
Navigating to Web Pages

Highlight search results