See the dojo/robotx reference documentation for more information.
Deferred that resolves when the _initRobot() has been called. Note to be confused with dojo/robotx.js, which defines initRobot() without an underscore
Deferred that resolves when startRobot() has signaled completing by typing on the keyboard, which in turn calls _run().
Parameter | Type | Description |
---|---|---|
x | Number | |
y | Number | |
absolute | Boolean | |
duration | Integer |
Optional
|
Parameter | Type | Description |
---|---|---|
docScreenX | undefined | |
docScreenY | undefined |
Opens the application at the specified URL for testing, redirecting dojo to point to the application environment instead of the test environment.
Parameter | Type | Description |
---|---|---|
url | String | URL to open. Any of the test's dojo.doc calls (e.g. dojo.byId()), and any dijit.registry calls (e.g. dijit.byId()) will point to elements and widgets inside this application. |
Holds down a single key, like SHIFT or 'a'.
Holds down a single key, like SHIFT or 'a'.
Parameter | Type | Description |
---|---|---|
charOrCode | Integer | char/JS keyCode/dojo.keys.* constant for the key you want to hold down Warning: holding down a shifted key, like 'A', can have unpredictable results. |
delay | Integer |
Optional Delay, in milliseconds, to wait before firing. The delay is a delta with respect to the previous automation call. For example, the following code ends after 600ms: robot.mouseClick({left: true}, 100) // first call; wait 100ms robot.typeKeys("dij", 500) // 500ms AFTER previous call; 600ms in all |
to hold down the 'a' key immediately, call robot.keyDown('a')
Types a key combination, like SHIFT-TAB.
Types a key combination, like SHIFT-TAB.
Parameter | Type | Description |
---|---|---|
charOrCode | Integer | char/JS keyCode/dojo.keys.* constant for the key you want to press |
delay | Integer |
Optional Delay, in milliseconds, to wait before firing. The delay is a delta with respect to the previous automation call. For example, the following code ends after 600ms: robot.mouseClick({left: true}, 100) // first call; wait 100ms robot.typeKeys("dij", 500) // 500ms AFTER previous call; 600ms in all |
modifiers | Object | JSON object that represents all of the modifier keys being pressed. It takes the following Boolean attributes:
|
asynchronous | Boolean | If true, the delay happens asynchronously and immediately, outside of the browser's JavaScript thread and any previous calls. This is useful for interacting with the browser's modal dialogs. |
to press shift-tab immediately, call robot.keyPress(dojo.keys.TAB, 0, {shift: true})
Releases a single key, like SHIFT or 'a'.
Releases a single key, like SHIFT or 'a'.
Parameter | Type | Description |
---|---|---|
charOrCode | Integer | char/JS keyCode/dojo.keys.* constant for the key you want to release Warning: releasing a shifted key, like 'A', can have unpredictable results. |
delay | Integer |
Optional Delay, in milliseconds, to wait before firing. The delay is a delta with respect to the previous automation call. For example, the following code ends after 600ms: robot.mouseClick({left: true}, 100) // first call; wait 100ms robot.typeKeys("dij", 500) // 500ms AFTER previous call; 600ms in all |
to release the 'a' key immediately, call robot.keyUp('a')
Convenience function to do a press/release. See robot.mousePress for more info.
Convenience function to do a press/release. See robot.mousePress for more info.
Parameter | Type | Description |
---|---|---|
buttons | Object | |
delay | Integer |
Optional
|
Moves the mouse to the specified x,y offset relative to the viewport.
Parameter | Type | Description |
---|---|---|
x | Number | x offset relative to the viewport, in pixels, to move the mouse. |
y | Number | y offset relative to the viewport, in pixels, to move the mouse. |
delay | Integer |
Optional Delay, in milliseconds, to wait before firing. The delay is a delta with respect to the previous automation call. For example, the following code ends after 600ms: robot.mouseClick({left: true}, 100) // first call; wait 100ms robot.typeKeys("dij", 500) // 500ms AFTER previous call; 600ms in all |
duration | Integer |
Optional Approximate time Robot will spend moving the mouse The default is 100ms. This also affects how many mousemove events will be generated, which is the log of the duration. |
absolute | Boolean | Boolean indicating whether the x and y values are absolute coordinates. If false, then mouseMove expects that the x,y will be relative to the window. (clientX/Y) If true, then mouseMove expects that the x,y will be absolute. (pageX/Y) |
Moves the mouse over the specified node at the specified relative x,y offset.
Moves the mouse over the specified node at the specified relative x,y offset. If you do not specify an offset, mouseMove will default to move to the middle of the node. Example: to move the mouse over a ComboBox's down arrow node, call doh.mouseMoveAt(dijit.byId('setvaluetest').downArrowNode);
Parameter | Type | Description |
---|---|---|
node | String | DOMNode | Function | The id of the node, or the node itself, to move the mouse to. If you pass an id or a function that returns a node, the node will not be evaluated until the movement executes. This is useful if you need to move the mouse to an node that is not yet present. |
delay | Integer, optional | Delay, in milliseconds, to wait before firing. The delay is a delta with respect to the previous automation call. For example, the following code ends after 600ms: robot.mouseClick({left:true}, 100) // first call; wait 100ms robot.typeKeys("dij", 500) // 500ms AFTER previous call; 600ms in all |
duration | Integer, optional | Approximate time Robot will spend moving the mouse The default is 100ms. |
offsetX | Number, optional | x offset relative to the node, in pixels, to move the mouse. The default is half the node's width. |
offsetY | Number, optional | y offset relative to the node, in pixels, to move the mouse. The default is half the node's height. |
Move the mouse from the current position to the specified point. Delays reading contents point until queued command starts running. See mouseMove() for details.
Parameter | Type | Description |
---|---|---|
point | Object | x, y position relative to viewport, or if absolute == true, to document |
delay | Integer |
Optional
|
duration | Integer |
Optional
|
absolute | Boolean |
Presses mouse buttons.
Presses the mouse buttons you pass as true. Example: to press the left mouse button, pass {left: true}. Mouse buttons you don't specify keep their previous pressed state.
Parameter | Type | Description |
---|---|---|
buttons | Object | JSON object that represents all of the mouse buttons being pressed. It takes the following Boolean attributes:
|
delay | Integer |
Optional Delay, in milliseconds, to wait before firing. The delay is a delta with respect to the previous automation call. For example, the following code ends after 600ms: robot.mouseClick({left: true}, 100) // first call; wait 100ms robot.typeKeys("dij", 500) // 500ms AFTER previous call; 600ms in all |
Releases mouse buttons.
Releases the mouse buttons you pass as true. Example: to release the left mouse button, pass {left: true}. Mouse buttons you don't specify keep their previous pressed state. See robot.mousePress for more info.
Parameter | Type | Description |
---|---|---|
buttons | Object | |
delay | Integer |
Optional
|
Spins the mouse wheel.
Spins the wheel wheelAmt "notches." Negative wheelAmt scrolls up/away from the user. Positive wheelAmt scrolls down/toward the user. Note: this will all happen in one event. Warning: the size of one mouse wheel notch is an OS setting. You can access this size from robot.mouseWheelSize
Parameter | Type | Description |
---|---|---|
wheelAmt | Number | Number of notches to spin the wheel. Negative wheelAmt scrolls up/away from the user. Positive wheelAmt scrolls down/toward the user. |
delay | Integer |
Optional Delay, in milliseconds, to wait before firing. The delay is a delta with respect to the previous automation call. For example, the following code ends after 600ms: robot.mouseClick({left: true}, 100) // first call; wait 100ms robot.typeKeys("dij", 500) // 500ms AFTER previous call; 600ms in all |
duration | Integer |
Optional Approximate time Robot will spend moving the mouse By default, the Robot will wheel the mouse as fast as possible. |
Scroll the passed node into view, if it is not.
Parameter | Type | Description |
---|---|---|
node | String | DOMNode | Function | The id of the node, or the node itself, to move the mouse to. If you pass an id or a function that returns a node, the node will not be evaluated until the movement executes. This is useful if you need to move the mouse to an node that is not yet present. |
delay | Number, optional | Delay, in milliseconds, to wait before firing. The delay is a delta with respect to the previous automation call. |
Defer an action by adding it to the robot's incrementally delayed queue of actions to execute.
Parameter | Type | Description |
---|---|---|
f | Function | A function containing actions you want to defer. It can return a Promise to delay further actions. |
delay | Integer |
Optional Delay, in milliseconds, to wait before firing. The delay is a delta with respect to the previous automation call. For example, the following code ends after 600ms: robot.mouseClick({left: true}, 100) // first call; wait 100ms robot.typeKeys("dij", 500) // 500ms AFTER previous call; 600ms in all |
duration | Integer |
Optional Delay to wait after firing. |
Set clipboard content.
Set data as clipboard content, overriding anything already there. The data will be put to the clipboard using the given format.
Parameter | Type | Description |
---|---|---|
data | String | New clipboard content to set |
format | String |
Optional Set this to "text/html" to put richtext to the clipboard. Otherwise, data is treated as plaintext. By default, plaintext is used. |
Types a string of characters in order, or types a dojo.keys.* constant.
Types a string of characters in order, or types a dojo.keys.* constant.
Parameter | Type | Description |
---|---|---|
chars | String | Number | String of characters to type, or a dojo.keys.* constant |
delay | Integer |
Optional Delay, in milliseconds, to wait before firing. The delay is a delta with respect to the previous automation call. For example, the following code ends after 600ms: robot.mouseClick({left: true}, 100) // first call; wait 100ms robot.typeKeys("dij", 500) // 500ms AFTER previous call; 600ms in all |
duration | Integer |
Optional Time, in milliseconds, to spend pressing all of the keys. The default is (string length)*50 ms. |
robot.typeKeys("dijit.ed", 500);
Notifies DOH that the doh.robot is about to make a page change in the application it is driving, returning a doh.Deferred object the user should return in their runTest function as part of a DOH test.
Parameter | Type | Description |
---|---|---|
submitActions | Function | The doh.robot will execute the actions the test passes into the submitActions argument (like clicking the submit button), expecting these actions to create a page change (like a form submit). After these actions execute and the resulting page loads, the next test will start. |
runTest: function(){ return waitForPageLoad(function(){ doh.robot.keyPress(keys.ENTER, 500); }); }
runTest: function(){ return waitForPageLoad(function(){ doh.robot.keyPress(keys.ENTER, 500); }); }