Skip to content

Win Check

Type: win-check  ·  Package: Desktop Activities v1.0.8

Checks or unchecks a checkbox in a desktop application. It guarantees the final state you want, regardless of how it was before.

It locates the control by its selector, brings its window to the front, reads its current state and only changes it when needed:

  • checked: leaves it checked (if it already was, it does nothing).
  • unchecked: leaves it unchecked.
  • toggle: inverts the current state.

That makes it idempotent: repeating it with checked or unchecked doesn’t change the result. It uses the UIA Toggle pattern; in Java applications it reads the state through the Swing bridge and, if it must change it, makes a physical click on the checkbox.

ParameterTypeDefaultDescription
selectorselector—The checkbox.
ParameterTypeDefaultDescription
sessionZoanDesktopSession—Win Attach session. Inside a body it is taken automatically; without a session, the selector must include the window.
statestringcheckedDesired state: checked · unchecked · toggle (inverts).
timeoutnumber30000Maximum ms to wait for the element. Empty = the project’s UI timeout or, if not set, 30000.

This activity does not return a value.

MessageCause and fix
The element does not support the Toggle pattern.The control is not a checkbox for UI Automation. Standard Windows radio buttons are usually in this case: select them with Win Click.
The element is outside the visible area and could not be scrolled into view, …The checkbox is hidden by its container’s scrolling. Add a Win Scroll before it.
Element not found with selector {…}.See common errors.
Win Check selector = (checkbox "I accept the terms") // check
Win Check selector = (checkbox "Receive emails") state = unchecked // uncheck

Check it only when a value asks for it, and verify:

If condition = taxExempt
└─ then:
Win Check selector = (checkbox "Tax exempt")
Win Get Attribute selector = (checkbox "Tax exempt") attribute = checked → output: isChecked