Page Method (Mobile Objects)

Applies to TestComplete 15.65, last modified on July 17, 2024
This method is available in legacy mobile tests that work with devices connected to the local computer. To learn how to simulate user actions in newer cloud-compatible mobile tests, see the Simulating user actions in tests section.

Description

The Page method returns a Page object that corresponds to the opened web page with the specified URL.

Declaration

TestObj.Page(URL, Index)

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]    Optional    Integer Default value: 0   
Result A Page object

Applies To

The method is applied to the following objects:

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 opened in the browser control. 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:

WebViewObj.Page("http://www.example.com/index.asp?sid=*")

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:

WebViewObj.Page("regexp:http://www.example.(com)|(net)|(org)/index.asp\?sid=.*")

Index

This parameter is only used if you open two or more pages with the same URL in the browser control. In this case, these pages have the same URL, so to distinguish the pages, TestComplete uses the Index parameter. The parameter specifies the order in which the pages were opened. If there is only one page with the specified URL, the Index parameter is not used.

Result Value

The Page object that that corresponds to the opened web page with the specified URL. If no page is found, the Page method returns an empty stub object. You can use the Exists property to check whether the page was found.

Remarks

To open a new web page in a browser control, use the ToUrl method.

During recording, TestComplete can ignore values of specific query string variables in the web page URL and replace them with the * wildcard in the recorded script. To enable this feature, use the Ignore dynamic URL parameters project option.

See Also

Testing Hybrid Mobile Applications (Legacy)
Navigating to Web Pages in Hybrid Applications (Legacy)

Highlight search results