WaitPage Method (Process Objects)

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

The WaitPage method pauses the test execution until a Page object with the specified URL appears in the object hierarchy or until the specified timeout elapses.

The WaitPage method is added only to processes that correspond to the supported web browsers. Also, this method is available only when the Web Testing plugins are installed and enabled in TestComplete.

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

TestObj.WaitPage(URL, Index, 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    
Index [in]    Required    Integer    
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:

processObj.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:

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

Index

This parameter is used if you open two or more web pages that have the same URL. The parameter is used to distinguish the pages from each other. It specifies the order, in which the pages were opened. The indexing starts from 0. However, Index is not used, if the browser contains only one page with the specified URL. If you open several pages that have the same URL, then TestComplete will not use Index to obtain the page that was opened first, and will use the indexes 1, 2, 3 and so on to obtain the other pages.

Timeout

The number of milliseconds to wait until the specified web page is loaded. 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 only added to the processes that correspond to the supported web browsers.

  • 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

Page Method (Browser and Process Objects)
Classic Web Testing
Wait For Web Pages

Highlight search results