Mozmill Base Object Interfaces

  • Revision slug: Mozmill/Mozmill_Base_Object_Interfaces
  • Revision title: Mozmill Base Object Interfaces
  • Revision id: 119004
  • Created:
  • Creator: Whimboo
  • Is current revision? No
  • Comment no wording changes

Revision Content

{{ Draft() }}

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.

Browser Functions

mozmill.getBrowserController

controller = mozmill.getBrowserController();

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

mozmill.newBrowserController

controller = mozmill.newBrowserController();

Forces the subsystem to open a new browser window and return a controller for it, regardless of how many other browser windows are open.  Supported for Firefox and Seamonkey.

mozmill.getDownloadsController

dwnlds = mozmill.getDownloadsController();

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

Thunderbird Functions

mozmill.getAddrbkController

abook = mozmill.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.

mozmill.newAddrbkController

abook = mozmill.newAddrbkController();

Forces the subsystem to open a new Thunderbird Addressbook window and return a controller for it.

mozmill.getMail3PaneController

tbird = mozmill.getMail3PanerController();

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

mozmill.newMail3PaneController

tbird = mozmill.newMail3PaneController();

Forces the subsystem to open a new Thunderbird window and return a controller for it.

 General Functions

The functions listed in this category will work with any of the supported applications.

mozmill.getAddonsController

addons = mozmill.getAddonsController();

Instantiates the AddOns window (or returns an Addons window if one is already open) and returns a controller for that.  Works in all supported applications.

mozmill.getPreferencesController

prefctrl = mozmill.getPreferencesController();

Instantiates the Preferences or Options window or returns a controller for an existing preference window if one is open.  Works on all supported applications.

mozmill.controller.MozMillController

var window = mozmill.wm.getMostRecentWindow('Browser:page-info');
var pageInfoController = new mozmill.controller.MozMillController(window);

Instantiates a controller object for the given window. Works on all supported applications and lets you work with windows which don't have a default controller listed above.

Revision Source

<p>{{ Draft() }}</p>
<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: <code>controller = mozmill.getBrowserController();</code>  This creates a "controller" object for the test to use.  The <a class="internal" href="/en/Mozmill_Tests/Mozmill_Controller_Object" title="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 <code>mozmill </code>to instantiate the controller.  The mozmill object API provides many convenience methods to help you get started testing specific applications.</p>
<h3>Browser Functions</h3> <h4>mozmill.getBrowserController</h4>
<pre>controller = mozmill.getBrowserController();
</pre>
<p>Gets a new browser controller for the currently open browser window.  If no browser window is open, it opens a new window and returns a controller for that. <em>Supported for Firefox and Seamonkey</em>.</p>
<h4>mozmill.newBrowserController</h4>
<pre>controller = mozmill.newBrowserController();
</pre>
<p>Forces the subsystem to open a new browser window and return a controller for it, regardless of how many other browser windows are open.  <em>Supported for Firefox and Seamonkey.</em></p>
<h4>mozmill.getDownloadsController</h4>
<pre>dwnlds = mozmill.getDownloadsController();
</pre>
<p>Instantiates the Downloads window and returns a controller for that or returns a controller to an already opened Downloads window. <em> Supported for Firefox</em>.</p>
<h3>Thunderbird Functions</h3> <h4>mozmill.getAddrbkController</h4>
<pre>abook = mozmill.getAddrbkController();
</pre>
<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.</p>
<h4>mozmill.newAddrbkController</h4>
<pre>abook = mozmill.newAddrbkController();
</pre>
<p>Forces the subsystem to open a new Thunderbird Addressbook window and return a controller for it.</p>
<h4>mozmill.getMail3PaneController</h4>
<pre>tbird = mozmill.getMail3PanerController();
</pre>
<p>Gets a controller for the current Thunderbird window.  If one is not open, it opens a window and returns a controller for that.  Works in Thunderbird.</p>
<h4>mozmill.newMail3PaneController</h4>
<pre>tbird = mozmill.newMail3PaneController();
</pre>
<p>Forces the subsystem to open a new Thunderbird window and return a controller for it.</p>
<h3> General Functions</h3>
<p>The functions listed in this category will work with any of the supported applications.</p>
<h4>mozmill.getAddonsController</h4>
<pre><code>addons = mozmill.getAddonsController();</code>
</pre>
<p>Instantiates the AddOns window (or returns an Addons window if one is already open) and returns a controller for that.  Works in all supported applications.</p>
<h4>mozmill.getPreferencesController</h4>
<pre><code>prefctrl = mozmill.getPreferencesController();</code></pre>
<p>Instantiates the Preferences or Options window or returns a controller for an existing preference window if one is open.  Works on all supported applications.</p>
<h4>mozmill.controller.MozMillController</h4>
<pre>var window = mozmill.wm.getMostRecentWindow('Browser:page-info');
var pageInfoController = new mozmill.controller.MozMillController(window);
</pre>
<p>Instantiates a controller object for the given window. Works on all supported applications and lets you work with windows which don't have a default controller listed above.</p>
Revert to this revision