LoadPage Method

Class

LoadPage is declared for the Browser window.

Action

Loads the specified page.

Availability

This functionality is supported only if you are using the Classic Agent. For additional information, refer to the Silk Test Classic Classic Agent Help.

Syntax

browser.LoadPage (blLocation [, sUser, sPassword])
Variable Description
blLocation The URL of the page to load. BROWSERLOCATION.
sUser Optional. The user name. STRING.
sPassword Optional. The password. STRING.

Notes

As part of its normal operation, LoadPage calls the OnLoadPage method, which checks for and handles windows invoked by LoadPage operations, for example, authentication dialogs, security dialogs, and browser messages and warnings.

BROWSERLOCATION is the union of the STRING and WINDOW data types.

Passing in a string as blLocation

If blLocation is a string, LoadPage calls the OnLoadpage method and passes the string to it as the first argument, sLocation, along with values for sUser and sPassword, if these were specified.

Passing in a window as blLocation

The main benefit of passing in a window to the LoadPage method is that it gives you the opportunity to customize the loading of a browser page. You accomplish this by defining your own OnLoadPage method for the window. You might want to redefine OnLoadPage, for example, to bypass unwanted windows that pop up before the desired page appears, such as sound clips or videos.

Note that in order to pass in a window as the value of blLocation, the window declaration must define a member or property, sURL, which specifies the URL to load. In this sense, passing in a window is equivalent to passing in a string as the value of blLocation.

The LoadPage method calls your custom OnLoadPage method and passes to it the definition of the window’s sURL as the first argument, sLocation. In addition, LoadPage passes for sUser and sPassword if these were specified.

If the page cannot be loaded, the AppError function is called.

Example

To display the Micro Focus home page, you can pass in a string.

Browser.LoadPage ("www.microfocus.com")

or pass in a window:

Browser.LoadPage (MicroFocusMain)