WaitPage Method (Window Objects)

Applies to TestComplete 15.63, last modified on April 23, 2024

Description

The WaitPage method is only added to those window objects that correspond to WebBrowser controls. Use this method to pause the script execution until a Page object with the specified URL appears in the object hierarchy or until the specified timeout elapses.

Declaration

TestObj.WaitPage(URL, Timeout)

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    
Timeout [in]    Required    Integer    
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

Specifies the URL of the web page being loaded. You can use wildcard characters (* and ?) or regular expressions in the ”regexp:pattern“ format to indicate the dynamic parts of the URL, such as values of the query string variables:

WindowObj.WaitPage("http://www.example.com/index.asp?sid=*", 5000)

The asterisk (*) corresponds to a string of any length, the question mark (?) corresponds to any single character.To specify more complicated parts of a URL, use regular expressions:

WindowObj.WaitPage("regexp:http://www.example.(com)|(net)|(org)/index.asp\?sid=.*", 5000)

Timeout

The number of milliseconds to wait until the Page object that corresponds to the web page appears in the object tree. If Timeout is 0, the method returns immediately. If Timeout is -1, the wait time is infinite.

Result Value

The Page object that provides scripting interface to the loaded web page and its child elements.

Remarks

  • The WaitPage method is added only to window objects corresponding to WebBrowser controls.

  • The WaitPage method waits for the corresponding Page object to become available. It does not wait for the page content to be fully downloaded. See Wait For Web Pages for information on specifics of loading web pages and for code samples.

See Also

Classic Web Testing
Page Object
Page Method (Window Objects)
Wait Method
Wait For Web Pages

Highlight search results