InvokeActionby Group Public on Wednesday April 07 2010 @ 16:28:01 (1/1 Points) |
|
| API ↪Reference ✑ Reply ✓ Stick It ✗ Ditch It ⚐ Tag It |
The InvokeAction# commands are used to perform individual user actions on UI elements. They are particular useful in cases with a lot of dynamic behaviour or inputs not within a form.
InvokeAction0 id:img1 LeftDown InvokeAction1 id:sel2 SelectSingle val3
LeftDown id:img1 SelectSingle id:sel2 val3
Syntax
Each action has a certain number of parameters expected for that action. You must use a function matching that number of parameters.
InvokeAction0 predicate action InvokeAction1 predicate action param1 InvokeAction2 precicate action param1 param2
In any case, the first parameter to the function is always a predicate→ which identifies the element on which to perform the action. The second parameter is always the action to perform.
Many of these actions have a direct short-cut function. These are then called by using the function name followed by the predicate, then the remaining arguments (skip the action). These items will be marked with a *.
List of Actions
Not all actions are available in all backends nor are they available or sensical for all element types. Always be aware that the exact behaviour of inputs, mouse events, and typing can vary greatly between browsers and operating systems. Where possible these actions will however have the same effect in all most configurations.
Refer to UIAction.java for the code level descriptions.
Mouse Actions
A common convention is that Left refers to the primary mouse button (usually the left one) and right refers to the secondary mouse button (usually the right one).
LeftClick*
Left-click on the element. For elements which can have the focus, this will usually result in them gaining the focus.
LeftDown*
Depress the left-button on the element. This may set the focus at this time.
LeftUp*
Release the left-button on the element.
MouseOver*
Positions the mouse over a new element. Be aware that most other actions will automatically move the mouse as well. TestPlan is attempting to mimic a user; a user must move the mouse over an element before they can click it.
For this same reason there is not a MouseOut seen in other frameworks. If you wish to move the mouse off of an element you simply move it over another element.
Text Actions
ClickReplaceType* text
Simulates setting the focus to the element, clearing the existing text (if any) and typing the new provided text.
Note: Be aware that this will not result in the onchange handler for an input being called. This is the same as in browser where the onchange tends only to be called when the focus of the item is lost. Call LeftClick on some other item.
Select Actions
Available on selection boxes.
SelectSingle* value
Select an item in a single-valued selection box.
SelectAdd* value
Add an item (select it) in a multi-valued selection box.
SelectRemove* value
Remove an item (deselect it) in a multi-valued selection box.
TestPlan InvokeAction
