Win Click
Win Click
Section titled “Win Click”Type: win-click · Package: Desktop Activities v1.0.8
Clicks a control in a desktop application: a button, a menu item, a tab, a cell. It is the most common interaction activity on the desktop.
How it works
Section titled “How it works”It locates the control by its selector (waiting up to timeout), brings its window to the front and, if the control is scrolled out of view, tries to scroll it into view. Then it clicks according to clickType (see interaction methods):
invoke(default), when the control is a button: activates it without moving the mouse. Native Windows buttons (Win32, WinForms) get a queued click, so a button that opens a modal dialog (“Are you sure?”) does not block the activity; the next step can act on that dialog. Other buttons use the UIA Invoke pattern and, if the action takes longer than 3 s (a dialog is open), the activity moves on without waiting for it. In this mode the button is always activated with a normal click, whateverbuttonsays.invokeon controls that are not buttons, ormouse: makes a physical mouse click at the control’s current center, with the button set inbutton.- In Java applications the click is always physical, at the actual position of the control located by the Swing bridge.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
selector | selector | — | The element to click. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanDesktopSession | — | Win Attach session. Inside a body it is taken automatically; without a session, the selector must include the window. |
button | string | left | Button: left · right · double (double click). |
clickType | string | invoke | Method: invoke (activates buttons without moving the mouse) · mouse (physical click). |
timeout | number | 30000 | Maximum ms to wait for the element. Empty = the project’s UI timeout or, if not set, 30000. |
Output
Section titled “Output”This activity does not return a value.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
Element not found with selector {…}. followed by Diagnostics: … | The control did not appear within timeout. Wait first with Win Wait For or check the selector. See common errors. |
The element is outside the visible area and could not be scrolled into view, … | The control is hidden by its container’s scrolling and could not be brought into view; the click would have landed elsewhere. Add a Win Scroll before it. |
The Java control could not be located unambiguously, so nothing was done. … | In a Java app there are several identical controls or the bridge cannot see it. Add an anchor or an idx to the selector. |
Could not map the Java control's coordinates to the screen … | Scaled display (125 %, 150 %) and the Java window could not be measured. Try with 100 % scaling on the robot’s machine. |
Example
Section titled “Example”Win Click selector = (button "Save")Win Click selector = (row "Invoice 001") button = double clickType = mouseWin Click selector = (file "report.xlsx") button = right clickType = mouse // context menuA button that opens a confirmation, and the click on the dialog:
Win Click selector = (button "Delete")Win Wait For selector = (button "Yes") state = visibleWin Click selector = (button "Yes")Related activities
Section titled “Related activities”- Win Type — type into a field.
- Win Wait For — wait for the control to be ready.
- Win Check — for checkboxes, regardless of their previous state.