QA/TDAI/Gristmill/Boilerplate Explained: Difference between revisions

 
Line 46: Line 46:


<pre>var controller = mozmill.getBrowserController();</pre>
<pre>var controller = mozmill.getBrowserController();</pre>
This gives us a controller object for the current browser window.  Most of the [[QA/TDAI/Gristmill_API|Gristmill API's]] are accessible through the controller object.
This gives us a controller object for the current browser window.  Most of the [[QA/TDAI/Gristmill/Gristmill_API|Gristmill API's]] are accessible through the controller object.


<pre>controller.open('http://www.google.com');</pre>
<pre>controller.open('http://www.google.com');</pre>
Line 55: Line 55:


<pre>controller.type(new elementslib.Name(controller.window.content.document, 'q'), 'Mozilla');</pre>
<pre>controller.type(new elementslib.Name(controller.window.content.document, 'q'), 'Mozilla');</pre>
This is a typical embedded statement.  The interior: "new elementslib.Name(controller.window.content.document, 'q')" piece creates an element object from the element in the content document named 'q'.  The content document is the loaded web page.  And the element named 'q' there is the search bar text box.  So this generates an element object referring to the search textbox.  You can find this name using the DOM Explorer Extension or the Explorers->DOM Explorer UI from the Mozmill IDE window.
This is a typical embedded statement.  The interior: "new elementslib.Name(controller.window.content.document, 'q')" piece creates an element object from the element in the content document named 'q'.  The content document is the loaded web page.  And the element named on this page named 'q' is the search bar text box.  So this generates an element object referring to the search textbox.  You can find this name using the DOM Explorer Extension or the Explorers->DOM Explorer UI from the Mozmill IDE window.


The rest of this statement then becomes a bit clearer if we substitute the word "TextBoxObject" for the element object we discussed above.  For example it becomes:
The rest of this statement then becomes a bit clearer if we substitute the word "TextBoxObject" for the element object we discussed above.  For example it becomes:
Confirmed users
3,816

edits