UIPage Object

Applies to TestComplete 14.92, last modified on September 16, 2021

Description

The object provides scripting access to the toolbars, menus, buttons and other controls and windows of the Firefox browser.

To implement the control and internal windows, Firefox uses XUL objects. The objects’ names correspond to the names of elements that are used to implement the controls. Each control contains methods and properties provided by TestComplete for onscreen objects and methods and properties of the appropriate XUL objects. You can work with these internal controls and windows the same way you work with web page elements displayed in Firefox.

To obtain the UIPage object in scripts, use the UIPage method of the firefox process.

The UIPage object is available only if —
  • You have an active license for TestComplete Web module.

  • You have the Web Testing and Firefox Support plugins enabled in TestComplete. These plugins are installed and enabled automatically.

    If you experience issues when working with the object, select File | Install Extensions from the TestComplete main menu to check whether the plugins are active. If the plugins are not available, run the TestComplete installation in the Repair mode.

Members

Example

The following example demonstrates how to obtain the UIPage object in script and how to use it to simulate actions over the Firefox browser's controls:

JavaScript, JScript

function Test()
{

  // Obtains the Firefox browser's process
  Browsers.Item(btFirefox).Run("about:blank");
  var firefox = Sys.Browser("firefox");
  // Obtains the UIPage object that provides access to the Firefox browser's controls
  var UIPage = firefox.UIPage("chrome://browser/content/browser.xul");

  // Obtains the Firefox browser's navigation bar
  var toolbar = UIPage.toolbar("nav_bar");
  // Simulates clicking the Home button
  toolbar.toolbarbutton("home_button").Click();
  firefox.Page("*").Wait();

}

Python

def Test():

  # Obtains the Firefox browser's process
  Browsers.Item[btFirefox].Run("about:blank");
  firefox = Sys.Browser("firefox")
  # Obtains the UIPage object that provides access to the Firefox browser's controls
  UIPage = firefox.UIPage("chrome://browser/content/browser.xul", 2)

  # Obtains the Firefox browser's navigation bar
  toolbar = UIPage.toolbar("nav_bar")
  # Simulates clicking the Home button
  toolbar.toolbarbutton("home_button").Click()
  firefox.Page("*").Wait()

VBScript

Sub Test
  Dim firefox, UIPage, toolbar

  ' Obtains the Firefox browser's process
  Browsers.Item(btFirefox).Run("about:blank")
  Set firefox = Sys.Browser("firefox")
  ' Obtains the UIPage object that provides access to the Firefox browser's controls
  Set UIPage = firefox.UIPage("chrome://browser/content/browser.xul")

  ' Obtains the Firefox browser's navigation bar
  Set toolbar = UIPage.toolbar("nav_bar")
  ' Simulates clicking the Home button
  toolbar.toolbarbutton("home_button").Click
  firefox.Page("*").Wait

End Sub

DelphiScript

procedure Test();
var firefox, UIPage, toolbar;
begin

  // Obtains the Firefox browser's process
  Browsers.Item[btFirefox].Run('about:blank');
  firefox := Sys.Browser('firefox');
  // Obtains the UIPage object that provides access to the Firefox browser's controls
  UIPage := firefox.UIPage('chrome://browser/content/browser.xul');

  // Obtains the Firefox browser's navigation bar
  toolbar := UIPage.toolbar('nav_bar');
  // Simulates clicking the Home button
  toolbar.toolbarbutton('home_button').Click();
  firefox.Page('*').Wait;

end;

C++Script, C#Script

function Test()
{

  // Obtains the Firefox browser's process
  Browsers["Item"](btFirefox)["Run"]("about:blank");
  var firefox = Sys["Browser"]("firefox");
  // Obtains the UIPage object that provides access to the Firefox browser's controls
  var UIPage = firefox["UIPage"]("chrome://browser/content/browser.xul");

  // Obtains the Firefox browser's navigation bar
  var toolbar = UIPage["toolbar"]("nav_bar");
  // Simulates clicking the Home button
  toolbar["toolbarbutton"]("home_button")["Click"]();
  firefox["Page"]("*").Wait();

}

See Also

UIPage Method
EvaluateXPath Method (UIPage Objects)
Classic Web Testing

Highlight search results