Description
The Page
test objects matches web pages that are displayed in stand-alone web browsers or in embedded browsers like Microsoft WebBrowser, Android WebView and Chromium. Using the same Page
object for different browsers help you unify your web tests.
The Page
object contains vast amount of methods and properties:
-
Methods and properties that are common for
onscreen
test objects in TestComplete. -
Methods and properties that let you obtain information about the Web browser, navigate to the desired URL, get the document scripting object and perform other actions.
-
For pages that are displayed in Mozilla Firefox or Internet Explorer, the
Page
object provides access to native methods and properties of theWebBrowser
control orGecko DOM Window
respectively.For other browsers and for the Android WebView controls these methods and properties are not available.
Note: If the native property or method name coincides with the property or method name provided by TestComplete, TestComplete places the native property to the NativeWebObject or NativeFirefoxObject namespace.
Requirements
To access the Page
object of a web page that is displayed in a desktop web browser or in an embedded browser control, you need to have plugins of the Web module enabled in TestComplete.
To access the Page
object of a web page that is displayed in a WebView control of an Android application, you need to have plugins of the Mobile module enabled in TestComplete. The Web module is not required in this case.
Members
Example
The following examples demonstrate how you can obtain the Page
object in your script by using the Page
method of the Browser
object. The Browser
object corresponds to the web browser process.
JavaScript, JScript
function WebSample()
{
Browsers.Item(btIExplorer).Run("http://smartbear.com/");
// Obtains the browser process
var browser = Sys.Browser("iexplore");
// Obtains the page currently opened in Internet Explorer
var page = browser.Page("*");
}
Python
def WebSample():
Browsers.Item[btIExplorer].Run("http://smartbear.com/");
# Obtains the browser process
browser = Sys.Browser("iexplore");
# Obtains the page currently opened in Internet Explorer
page = browser.Page("*");
VBScript
Sub WebSample
Browsers.Item(btIExplorer).Run("http://smartbear.com/")
' Obtains the browser process
Set browser = Sys.Browser("iexplore")
' Obtains the page currently opened in Internet Explorer
Set page = browser.Page("*")
End Sub
DelphiScript
procedure WebSample();
var browser, page;
begin
Browsers.Item(btIExplorer).Run('http://smartbear.com/');
// Obtains the browser process
browser := Sys.Browser('iexplore');
// Obtains the page currently opened in Internet Explorer
page := browser.Page('*');
end;
C++Script, C#Script
function WebSample()
{
Browsers["Item"](btIExplorer)["Run"]("http://smartbear.com/");
// Obtains the browser process
var browser = Sys["Browser"]("iexplore");
// Obtains the page currently opened in Internet Explorer
var page = browser["Page"]("*");
}
See Also
Page Method (Browser and Process Objects)
Testing Web Applications
Testing Hybrid Mobile Applications