Click-Image
Command Description
Find the image in the specified area and click on it
Command Prototype
Image.Click(objUiElement,objRect,sImagePath,iAccuracy,iButton,iType,iTimeOut, optionArgs)
Parameter Description
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
objUiElement | True | decorator | @ui"" | When the attribute is transferred as a string, it is used as the characteristic string to find the interface element. When the attribute is transferred as UiElement, directly click on the corresponding interface element |
objRect | True | dictionary | {"x": 0, "y": 0, "width": 0, "height": 0} | Perform text recognition in the search area. If the area is passed as {"x":0,"y":0,"width":0,"height":0}, then the text will be recognized in the rectangle area of the control element |
sImagePath | True | path | '''C:\Users''' | The path of the image to be found, generally in the res folder |
iAccuracy | True | number | 0.9 | Similarity to be used for finding images, ranging from 0.5 - 1.0, ie. similarity of 50% - 100% |
iButton | True | enum | "left" | Mouse button {left: Left button, right: Right button, middle: Middle button} |
iType | True | enum | "click" | Click type {click: single click, dbclick: double click, down: keydown, up: keyup} |
iTimeOut | True | number | 10000 | Specify the amount of time (in milliseconds) that wait for the event to run before selectorNotFoundException to trigger an error (in milliseconds) The default value is 10,000 ms (10 seconds) |
bContinueOnError | None | boolean | None | Specify whether the automation should continue to support this field even if the activity is incorrect, it is only supported by the Boolean value (true, false) default value |
iDelayAfter | None | number | 300 | Delay time (in milliseconds) after executing the activity is 300 milliseconds |
iDelayBefore | None | number | 200 | The delay time (in milliseconds) before any operations are executed is by default 200 milliseconds |
bSetForeground | None | boolean | True | Whether to activate the target window before executing |
sCursorPosition | None | enum | "Center" | Describes the cursor start point for adding offsets for the offsetx and offsety properties. The following options are available: topleft, topright, bottomleft, bottomlight, and center. The default option is center |
iCursorOffsetX | None | number | 10 | The horizontal movement of the cursor based on the option in the "Position" field |
iCursorOffsetY | None | number | 10 | The vertical offset of the cursor position based on the option selected in the "Position" field |
sKeyModifiers | None | set | [] | Keyboard keys used while a mouse action is triggered: Alt, Ctrl, Shift, Win |
sSimulate | None | enum | "simulate" | Available operation types are: Background Operation (uia), Simulated Operation (simulate), System Message(message). Default: Simulated Operation (simulate) |
sMatchType | None | enum | "GrayMatch" | Specify a match type for an image. Gray-scale matching is fast, but it may fail in extreme situations. The color matching is more accurate, but the matching speed is slightly slower |
iSerialNo | None | number | 1 | The specified image is matched to multiple targets. The sequence number of the targets is a positive integer starting from 1 and increases from left to right and from top to botton on the screen. The sequence number of the target closest to the upper left corner of the screen is 1 |
Demo
TracePrint "--------------------click on image--------------------"
// --------------------------------------------------------
// [Remarks] Click on the image, the Demo needs to use IE to open the URL below
// url: http://www.vrbrothers.com/cn/wqm/demo/pages/Demo-ComplexForm.aspx
// Input parameter 1:
// objUiElement--target element
// Input parameter 2:
// objRect--identification range
// Input parameter 3:
// sImagePath--find pictures
// Input parameter 4:
// iAccuracy--similarity
// Input parameter 5:
// iButton--mouse click (left/right/middle)
// Input parameter 6:
// iType--click type (click / double click / press / pop up)
// Input reference 7:
// iTimeOut--timeout time. Default unit: milliseconds. Type: Int
// Into reference 8:
// optionArgs--optional parameters (including: error continue execution/delay after execution/delay before execution/activation window/cursor position/abscissa offset/ordinate offset/assistant key/operation Type/matching method/matching number).Type:Dict
// 命令原型:Image.Click(objUiElement,objRect,sImagePath,iAccuracy,iButton,iType,iTimeOut, optionArgs)
// --------------------------------------------------------
Image.Click (@ui "Simulation_www.vrbrothers.com/cn/wqm/demo/pages/Demo-Compl4", {"x": 0, "y": 0, "width": 0, "height": 0}, @ res "5ebc8ae0-ae64-11ec-896f-a79dc01a345c.png", 0.9, "left", "click", 10000, {"bContinueOnError": false, " iDelayAfter ": 300, " iDelayBefore ": 200, " bSetForeground ": true, " sCursorPosition ": " Center ", " iCursorOffsetX ": 10, " iCursorOffsetY ": 10, " sKeyModifiers ": []," sSimulate ": " simulate "," sMatchType ":" GrayMatch ", " iSerialNo ": 1})