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

AttributeTypeDescription
platformobjectThe 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.
isWindowsbooleanTrue if the current platform is a Windows operating system
isLinuxbooleanTrue if the current platform is a Linux operating system
isMacbooleanTrue if the current platform is a Mac OS X operating system
wmnsIWindowMediatorShortcut to the nsIWindowsMediator service, for an example of use see controller.MozMillController below
appInfonsIXULAppInfoShortcut 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);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:66 次

字数:13177

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文