MDN may have intermittent access issues April 18 13:00 - April 19 01:00 UTC. See whistlepig.mozilla.org for all notifications.

mozilla

Revision 119006 of Mozmill Base Object Interfaces

  • Revision slug: Mozmill/Mozmill_Base_Object_Interfaces
  • Revision title: Mozmill Base Object Interfaces
  • Revision id: 119006
  • Created:
  • Creator: Ctalbert
  • Is current revision? No
  • Comment 45 words added, 1753 words removed
Tags: 

Revision Content

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 {{ interface(nsIWindowsMediator) }}nsIWindowsMediator Shortcut to the nsIWindowsMediator service, for an example of use see controller.MozMillController below
appInfo {{ interface(nsIXULAppInfo) }}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();

getAddrbkController()

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 {{interface(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);

Revision Source

<p>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 <a href="/en/Mozmill_Tests/Mozmill_Controller_Object">controller object</a> 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.</p>
<h2>Method overview</h2>
<table class="standard-table"> <tbody> <tr> <td><code><a href="/en/Mozmill_Tests/Mozmill_Controller_Object">controller</a> <a href="#getBrowserController.28.29">getBrowserController</a>();</code></td> </tr> <tr> <td><code><a href="/en/Mozmill_Tests/Mozmill_Controller_Object">controller</a> <a href="#newBrowserController.28.29">newBrowserController</a>();</code></td> </tr> <tr> <td><code><a href="/en/Mozmill_Tests/Mozmill_Controller_Object">controller</a> <a href="#getDownloadsController.28.29">getDownloadsController</a>();</code></td> </tr> <tr> <td><code><a href="/en/Mozmill_Tests/Mozmill_Controller_Object">controller</a> <a href="#getAddrbkController.28.29">getAddrbkController</a>();</code></td> </tr> <tr> <td><code><a href="/en/Mozmill_Tests/Mozmill_Controller_Object">controller</a> <a href="#newAddrbkController.28.29">newAddrbkController</a>();</code></td> </tr> <tr> <td><code><a href="/en/Mozmill_Tests/Mozmill_Controller_Object">controller</a> <a href="#getMail3PaneController.28.29">getMail3PaneController</a>();</code></td> </tr> <tr> <td><code><a href="/en/Mozmill_Tests/Mozmill_Controller_Object">controller</a> <a href="#newMail3PaneController.28.29">newMail3PaneController</a>();</code></td> </tr> <tr> <td><code><a href="/en/Mozmill_Tests/Mozmill_Controller_Object">controller</a> <a href="#getAddonsController.28.29">getAddonsController</a>();</code></td> </tr> <tr> <td><code><a href="/en/Mozmill_Tests/Mozmill_Controller_Object">controller</a> <a href="#getPreferencesController.28.29">getPreferencesController</a>();</code></td> </tr> <tr> <td><code><a href="/en/Mozmill_Tests/Mozmill_Controller_Object">controller</a> <a href="#controller.MozmillController.28.29">controller.MozmillController</a>();</code></td> </tr> </tbody>
</table> <h2>Attributes</h2>
<table class="standard-table"> <thead> <tr> <th scope="col">Attribute</th> <th scope="col">Type</th> <th scope="col">Description</th> </tr> </thead> <tbody> <tr> <td><code>platform</code></td> <td>object</td> <td>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.</td> </tr> <tr> <td><code>isWindows</code></td> <td>boolean</td> <td>True if the current platform is a Windows operating system</td> </tr> <tr> <td><code>isLinux</code></td> <td>boolean</td> <td>True if the current platform is a Linux operating system</td> </tr> <tr> <td><code>isMac</code></td> <td>boolean</td> <td>True if the current platform is a Mac OS X operating system</td> </tr> <tr> <td><code>wm</code></td> <td>{{ interface(nsIWindowsMediator) }}nsIWindowsMediator</td> <td>Shortcut to the nsIWindowsMediator service, for an example of use see controller.MozMillController below</td> </tr> <tr> <td><code>appInfo</code></td> <td>{{ interface(nsIXULAppInfo) }}nsIXULAppInfo</td> <td>Shortcut to the nsIXULAppInfo service.</td> </tr> </tbody>
</table> <h2>Browser Methods</h2>
<h3 name="getBrowserController.28.29">getBrowserController()</h3>
<p>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.</p>
<pre>controller getBrowserController(); 
</pre>
<h6>Parameters</h6>
<p>None</p>
<h6>Return value</h6>
<p><code>controller</code> Returns a <a href="/en/Mozmill_Tests/Mozmill_Controller_Object">controller object</a> for the window.</p>
<h6>Example</h6>
<pre class="brush: js">controller = mozmill.getBrowserController();
</pre> <h3 name="newBrowserController.28.29">newBrowserController()</h3>
<p>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.</p>
<pre>controller newBrowserController(); 
</pre>
<h6>Parameters</h6>
<p>None</p>
<h6>Return value</h6>
<p><code>controller</code> Returns a <a href="/en/Mozmill_Tests/Mozmill_Controller_Object">controller object</a> for the window.</p>
<h6>Example</h6>
<pre class="brush: js">controller = mozmill.newBrowserController();
</pre> <h3 name="getDownlaodsController.28.29">getDownloadsController()</h3>
<p>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.</p>
<pre>controller getDownloadsController(); 
</pre>
<h6>Parameters</h6>
<p>None</p>
<h6>Return value</h6>
<p><code>controller</code> Returns a <a href="/en/Mozmill_Tests/Mozmill_Controller_Object">controller object</a> for the window.</p>
<h6>Example</h6>
<pre class="brush: js">controller = mozmill.getDownloadsController();
</pre> <h2>Mail Methods</h2>
<h3 name="getAddrbkController.28.29">getAddrbkController()</h3>
<p>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.</p>
<pre>controller getAddrbkController(); 
</pre>
<h6>Parameters</h6>
<p>None</p>
<h6>Return value</h6>
<p><code>controller</code> Returns a <a href="/en/Mozmill_Tests/Mozmill_Controller_Object">controller object</a> for the window.</p>
<h6>Example</h6>
<pre class="brush: js">controller = mozmill.getAddrbkController();
</pre> <h3 name="newAddrbkController.28.29">newAddrbkController()</h3>
<p>Forces the system to create a new addressbook window and returns a controller for that. Supported in Thunderbird.</p>
<pre>controller newAddrbkController(); 
</pre>
<h6>Parameters</h6>
<p>None</p>
<h6>Return value</h6>
<p><code>controller</code> Returns a <a href="/en/Mozmill_Tests/Mozmill_Controller_Object">controller object</a> for the window.</p>
<h6>Example</h6>
<pre class="brush: js">controller = mozmill.newAddrbkController();
</pre> <h3 name="getMail3PaneController.28.29">getAddrbkController()</h3>
<p>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.</p>
<pre>controller getMail3PaneController(); 
</pre>
<h6>Parameters</h6>
<p>None</p>
<h6>Return value</h6>
<p><code>controller</code> Returns a <a href="/en/Mozmill_Tests/Mozmill_Controller_Object">controller object</a> for the window.</p>
<h6>Example</h6>
<pre class="brush: js">controller = mozmill.getMail3PaneController();
</pre> <h3 name="newAddrbkController.28.29">newMail3PaneController()</h3>
<p>Forces the system to create a new main Thunderbird window and returns a controller for that. Supported in Thunderbird.</p>
<pre>controller newMail3PaneController(); 
</pre>
<h6>Parameters</h6>
<p>None</p>
<h6>Return value</h6>
<p><code>controller</code> Returns a <a href="/en/Mozmill_Tests/Mozmill_Controller_Object">controller object</a> for the window.</p>
<h6>Example</h6>
<pre class="brush: js">controller = mozmill.newMail3PaneController();
</pre> <h2>General Methods</h2>
<h3 name="getAddonsController.28.29">getAddonsController()</h3>
<p>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.</p>
<pre>controller getAddonsController(); 
</pre>
<h6>Parameters</h6>
<p>None</p>
<h6>Return value</h6>
<p><code>controller</code> Returns a <a href="/en/Mozmill_Tests/Mozmill_Controller_Object">controller object</a> for the window.</p>
<h6>Example</h6>
<pre class="brush: js">controller = mozmill.getAddonsController();
</pre> <h3 name="getPreferencesController.28.29">getPreferencesController()</h3>
<p>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.</p>
<pre>controller getPreferencesController(); 
</pre>
<h6>Parameters</h6>
<p>None</p>
<h6>Return value</h6>
<p><code>controller</code> Returns a <a href="/en/Mozmill_Tests/Mozmill_Controller_Object">controller object</a> for the window.</p>
<h6>Example</h6>
<pre class="brush: js">controller = mozmill.getPreferencesController();
</pre> <h3 name="controller.MozMillController.28.29">controller.MozMillController()</h3>
<p>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.</p>
<pre>controller controller.MozMillController(in {{interface(nsIDOMWindow)}} window); 
</pre>
<h6>Parameters</h6>
<dl> <dt><code>window</code></dt> <dd>The DOM Window you wish to wrap into a controller object</dd>
</dl>
<h6>Return value</h6>
<p><code>controller</code> Returns a <a href="/en/Mozmill_Tests/Mozmill_Controller_Object">controller object</a> for the window.</p>
<h6>Example</h6>
<pre class="brush: js">// 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);
</pre>
Revert to this revision