动作定义
control_action 定义
针对当前的控件元素,可以执行一些动作,如下标所示。如invoke为对当前控件执行一次调用,click则是在当前元素上模拟鼠标点一下。
注意:可以使用两种方式调用: 感叹号加上动作序号,如!4 代表 expend ; 也可以直接使用动作名称,如 click Select 等等,二者是等价的
执行动作时,如果需要参数,可使用如下方式提供:
1.直接跟参数字符串,如Getitem 5,3
2.直接跟表达式,如actionname < $param : 此时对$param 的解释依据参数的数量不同, 如果多个变量, 则为一个字符串, 如果只有一个, 有可能$param就是这个变量, 也有可能是字符串。
3.放到$1,$2中。当既不跟字符串,也没有跟变量的时候,则认为是放在$1,$2中的。
执行动作的时候,如果需要取值,则放在$$里面。
| 语句 | 动作序号 | 参数 | 描述 |
|---|---|---|---|
| Invoke | 1 | Invoke Pattern | |
| Click | 2 | Any Pattern, get the position, and send mouse action on it | |
| Select | 3 | Selectionitem, note that selectpattern has no action. | |
| Expand | 4 | ExpandCollapse | |
| Collapse | 5 | ExpandCollapse | |
| GetItem | 6 | Element (int row, int column) | Grid,Table note that griditem and tableitem has no action. |
| GetSelection | 7 | String () | Text Assemble a string by using TextPatternRange[] |
| GetVisibleRanges | 8 | String () | Text Assemble a string by using TextPatternRange[] |
| Toggle | 9 | Toggle change the status alternatively | |
| FetchData | 10 | String () | AnyPattern A complex action: assembling a string by record all child's name property |
| SetValueRange | 11 | (float) | rangeValue |
| SetValue | 12 | (string) | value |
| SetDock | 13 | (int) | Dock cast the int into the enum DockPosition top,left,bottom,right,fill,none=012345 |
| GetViewName | 14 | string (int viewID) | multipleView (int viewID) |
| SetCurrentView | 15 | (int viewID) | multipleView (int viewID) |
| SetScrollPercent | 16 | (double horizonalpercent, verticalpercent) | Scroll (double horizonalpercent, verticalpercent) |
| ScrollIntoView | 17 | scrollitem | |
| Close | 18 | window | |
| Maximum | 19 | Window Set the window maximum. | |
| Minimum | 20 | Window Set the window minimum. | |
| WaitForInputIdle | 21 | (the time to wait, milliseconds) | Window (the time to wait, milliseconds) |
| SetState | 22 | (int) | window SetWindowVisualState(WindowVisualState.Normal); normal,max,min=012 |
| Move | 23 | (double x, y) | Transform (double x, y) |
| Resize | 24 | (double width, height) | Transform (double width, height) |
| Rotate | 25 | (double degrees) | Transform (double degrees) |
| AddToSelection | 26 | selectionitem, note that selectpattern has no action. | |
| RemoveFromSelection | 27 | selectionitem | |
| DoubleClick | 28 | ||
| RightClick | 29 | ||
| SetFocus | 30 | put the current element as focused if it could be focused. | |
| TopMost | 31 | put the window in the upmost | |
| CutElement | 32 | (string filename) | cut the picture of the current element, 如果没有文件名,则自动生成一个,放到bizrunner安装目录下的tmp目录下面;如果有文件名而且以\开头,则加上bizrunner的安装目录。下同 |
| CutWindow | 33 | (filename) | cut the current window |
| CutScreen | 34 | (filename) | cut the screen where the current element is in |
| RunIt | 35 | 作为一个抽象的动作,执行它,针对不同的控件类型进行不同的解释。 |
public enum USERACTION
{
None = 0,
Invoke = 1, // InvokePattern
Click = 2,
Select = 3, // selectionitem, note that selectpattern has no action.
Expand = 4,//ExpandCollapse
Collapse = 5,
GetItem = 6, // Grid, Table (row, column) note that griditem and tableitem has no action.
GetSelection = 7, // Text
GetVisibleRanges = 8,
Toggle = 9, // toggle pattern
FetchData = 10, // a complex action
SetValueRange = 11, // rangeValue (double)
SetValue = 12,// value(string),
SetDock = 13, // Dock
GetViewName = 14, // multipleView (int viewID)
SetCurrentView = 15, // (int viewID)
SetScrollPercent = 16, // Scroll (double horizonalpercent, verticalpercent)
ScrollIntoView = 17, // scrollitem
Close = 18, // window
Maximum = 19, // Set the window maximum.
Minimum = 20,
WaitForInputIdle = 21, // (the time to wait, milliseconds)
SetState = 22, //SetWindowVisualState(WindowVisualState.Normal);
Move = 23, // Transform (double x, y)
Resize = 24, // (double width, height)
Rotate = 25, // (double degrees)
AddToSelection = 26, // selectionitem, note that selectpattern has no action.
RemoveFromSelection = 27,
DoubleClick = 28,
RightClick = 29,
SetFocus = 30, // put the current element as focused if it could be focused.
TopMost = 31, // put the window in the upmost
CutElement = 32, // cut the picture of the current element
CutWindow = 33, // cut the current window
CutScreen = 34, // cut the screen where the current element is in
RunIt = 35, // 作为一个抽象的动作,执行它,针对不同的控件类型进行不同的解释。
}
| << 控件类型与属性列表 | SendKeys 说明 >> |