QA/TDAI/Gristmill/Gristmill API
This explains the Gristmill APIs that you can use in your tests.
Action APIs
controller.open(url, elementToWaitFor)
Parameters | |
url | A URL to open |
Open is a mechanism to open a the given URL in the currently focused tab/window of the window that is under control by the controller.
controller.keypress(el, keycode)
Parameters | |
el | An element that the event will be targeted at |
keycode | The keycode that you wish to send to that element. |
Sends a single key event to the designated element object.
controller.type(el, text)
Parameters | |
el | An element that the event will be targeted at |
text | The text to be typed into the given element object |
Fires type events (simulating both the keydown and keyup) at the given element object. If the text is longer than the available length on the element object, the text will be truncated to fit.
controller.click(el)
Parameters | |
el | An element that the event will be targeted at |
Sends a single mouse click to the element object
controller.select(el)
Parameters | |
el | An element that the event will be targeted at |
Selects the specified option and triggers the relevant selection events on the given element object. TODO: Determine if this code works.
controller.mousedown(el)
Parameters | |
el | An element that the event will be targeted at |
Sends the "mousedown" (mouse button depressed) event to the element object.
controller.mouseup(el)
Parameters | |
el | An element that the event will be targeted at |
Sends the "mouseup" (mouse button released) event to the element object.
controller.mouseover(el)
Parameters | |
el | An element that the event will be targeted at |
Sends the "mouseover" (mouse drug over an element) event to the element object.
controller.mouseout(el)
Parameters | |
el | An element that the event will be targeted at |
Sends the "mouseout" (mouse drug off an element) event to the element object.
controller.check(el)
Parameters | |
el | An element that the event will be targeted at |
Causes the element to be "checked" if it is a checkbox. If it is not a checkbox, it causes a click on the element.
controller.radio(el)
Parameters | |
el | An element that the event will be targeted at |
Selects a radio button element. If the element is not a radio button entry, then it causes a generic click against that element.
controller.doubleclick(el)
Parameters | |
el | An element that the event will be targeted at |
Causes a doubleclick event to be fired at the element object.
Browser Shortcut Action APIs
controller.goBack()
Causes the browser to go back one step in history.
controller.goForward()
Causes the browser to go forward one step in history.
controller.refresh()
Causes the browser to refresh the current document.