NavigateTo Method (Window Objects)

Applies to TestComplete 15.63, last modified on April 10, 2024
This method is obsolete. See the Remarks section below.

Description

The NavigateTo method is only added to window objects that correspond to WebBrowser controls. It lets you open the specified page in a WebBrowser control.

The NavigateTo method performs the same actions as the NavigateTo method of the Page object that corresponds to the tested web page. However, it lets you navigate to web pages without having to obtain the Page object that provides access to web pages.

Like the ToUrl method of the window object, NavigateTo waits until the specified page is loaded. However, unlike ToURL, it does not return any value. So, after you call NavigateTo, you will have to obtain the Page object that corresponds to the loaded page. For more information on this, see Navigate to Web Pages.

Declaration

TestObj.NavigateTo(URL, WaitTime)

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 None

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 of the page to be opened in the browser.

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

None.

Remarks

  • This method is obsolete. To open the specified page in a WebBrowser control, use the ToUrl method.

  • 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 NavigateTo method is only added to window objects that correspond to WebBrowser controls. This method is an analogue of the Page.NavigateTo method. However, it lets you load web pages in a browser without having to obtain the Page object that provides access to web pages.

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

  • The NavigateTo method is similar to the ToURL method. The difference is that ToUrl returns the Page object that corresponds to the loaded page, whereas NavigateTo does not return any value.

Example

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

See Also

Classic Web Testing
ToUrl Method (Window Objects)
URL Property
Wait Method
NavigateTo Method (Window Objects)
Navigate to Web Pages

Highlight search results