Every repository with this icon (
Every repository with this icon (
Tab Scripting
Introduction
This functionality is designed to make it possible for a user to open a tab, and automate the user actions required to get that tab to a usable state. A lot of the time this means a login, or clicking on some content to dynamically configure the page. Using the MozMillController you can basically simulate anything in that tab that a user could do making this functionality very powerful and useful.
Objects in Scope
- win – The content window for the tab.
- doc – The content document for the tab
- tab – An instance of MozMillController scoped to the tab content window.
- elementslib – The elementslib object, allowing for lookups of elements on the page to interact with
Example Scripts
Facebook Login
//Lookup the three elements I want to interact with var email = new elementslib.ID(doc, 'email'); var pass = new elementslib.ID(doc, 'pass'); var login = doc.getElementsByClassName('UIButton_Text')[0];//Controller expects elementslib objects
var elibLogin = new elementslib.Elem(login);//Tell the controller to type the credentials
tab.type(email, ‘my_facebook_account@address.com’);
tab.type(pass, ‘my_password’);
//Click the login button
tab.click(elibLogin);
Wordpress Login
//Lookup the three elements I want to interact with var uname = new elementslib.ID(doc, 'user_login'); var pass = new elementslib.ID(doc, 'user_pass'); var login = new elementslib.ID(doc, 'wp-submit');//Tell the controller to type the credentials
tab.type(uname, ‘wordpress_username’);
tab.type(pass, ‘wordpress_password’);
//Click the login button
tab.click(login);






