Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Mozmill Base Object Interfaces

At the top of many Mozmill tests you will see a line that contains a setupModule function with something that looks like the following code in it: controller = mozmill.getBrowserController(); This creates a "controller" object for the test to use. The controller object is the heart of all Mozmill interfaces in that it allows you to completely control the application under test. However, this makes use of a global object called mozmill to instantiate the controller. The mozmill object API provides many convenience methods to help you get started testing specific applications.

Method overview

controller getBrowserController();
controller newBrowserController();
controller getDownloadsController();
controller getAddrbkController();
controller newAddrbkController();
controller getMail3PaneController();
controller newMail3PaneController();
controller getAddonsController();
controller getPreferencesController();
controller controller.MozmillController();

Attributes

Attribute Type Description
platform object The name of the platform according to the Gecko subsystem, i.e. Mac == Darwin, Windows == winnt, linux == linux. For more specifc testing use the "is" attributes below.
isWindows boolean True if the current platform is a Windows operating system
isLinux boolean True if the current platform is a Linux operating system
isMac boolean True if the current platform is a Mac OS X operating system
wm nsIWindowMediator Shortcut to the nsIWindowsMediator service, for an example of use see controller.MozMillController below
appInfo nsIXULAppInfo Shortcut to the nsIXULAppInfo service.

Browser Methods

getBrowserController()

Gets a new browser controller for the currently open browser window. If no window is open, it opens a new window and returns a controller for that. Supported in Firefox and Seamonkey.

controller getBrowserController(); 
Parameters

None

Return value

controller Returns a controller object for the window.

Example
controller = mozmill.getBrowserController();

newBrowserController()

Forces creation of a new browser window and returns a controller for it, regardless of how many other browser windows are open. Supported in Firefox and Seamonkey.

controller newBrowserController(); 
Parameters

None

Return value

controller Returns a controller object for the window.

Example
controller = mozmill.newBrowserController();

getDownloadsController()

Instantiates the Downloads window and returns a controller for that or returns a controller to an already opened Downloads window. Supported in Firefox and Seamonkey.

controller getDownloadsController(); 
Parameters

None

Return value

controller Returns a controller object for the window.

Example
controller = mozmill.getDownloadsController();

Mail Methods

getAddrbkController()

Gets a controller for the current Thunderbird Addressbook window. If one is not open, it opens a window and returns a controller for that. Supported in Thunderbird.

controller getAddrbkController(); 
Parameters

None

Return value

controller Returns a controller object for the window.

Example
controller = mozmill.getAddrbkController();

newAddrbkController()

Forces the system to create a new addressbook window and returns a controller for that. Supported in Thunderbird.

controller newAddrbkController(); 
Parameters

None

Return value

controller Returns a controller object for the window.

Example
controller = mozmill.newAddrbkController();

getMail3PaneController()

Gets a controller for the current Thunderbird window. If one is not open, it opens a window and returns a controller for that. Supported in Thunderbird.

controller getMail3PaneController(); 
Parameters

None

Return value

controller Returns a controller object for the window.

Example
controller = mozmill.getMail3PaneController();

newMail3PaneController()

Forces the system to create a new main Thunderbird window and returns a controller for that. Supported in Thunderbird.

controller newMail3PaneController(); 
Parameters

None

Return value

controller Returns a controller object for the window.

Example
controller = mozmill.newMail3PaneController();

General Methods

getAddonsController()

Creates a controller for the currently open Add-Ons window, if one is not open, it opens one and returns the controller for that. Supported in all applications that use the toolkit Extension Manager to manage addons.

controller getAddonsController(); 
Parameters

None

Return value

controller Returns a controller object for the window.

Example
controller = mozmill.getAddonsController();

getPreferencesController()

Creates a controller for the currently open Preferences window, if one is not open, it opens one and returns the controller for that. Supported in all applications.

controller getPreferencesController(); 
Parameters

None

Return value

controller Returns a controller object for the window.

Example
controller = mozmill.getPreferencesController();

controller.MozMillController()

Creates a controller for the given window. This works on all supported applications and allows you to create controllers for windows that do not have a convenience method above. Supported in all applications.

controller controller.MozMillController(in nsIDOMWindow window); 
Parameters
window
The DOM Window you wish to wrap into a controller object
Return value

controller Returns a controller object for the window.

Example
// Creates a controller for the browser's page information dialog.
// It assumes that you've already clicked on the proper icons to launch the dialog.
let window = mozmill.wm.getMostRecentWindow('Browser:page-info');
let pageInfoController = new mozmill.controller.MozMillController(window);

Document Tags and Contributors

Tags: 
 Contributors to this page: teoli, trevorh, Parasyte, Ctalbert, Whimboo
 Last updated by: trevorh,