Win Type
Win Type
Section titled “Win Type”Type: win-type · Package: Desktop Activities v1.0.8
Types text into an input field of a desktop application. It’s how you fill in forms: user, password, search values, data entry.
How it works
Section titled “How it works”It locates the field by its selector, brings its window to the front and types text according to method (see interaction methods):
value(default): sets the text through the UIA Value pattern, all at once. It replaces the field’s content even withclear = false. If the field doesn’t support the Value pattern, or it is read-only for UIA, it switches to keyboard simulation by itself.simulate: focuses the field (in Java applications, with a click on it), clears it with Ctrl+A and Delete ifclear = true, and types the text letter by letter. Withclear = falsethe text is added where the cursor is.
Windows date pickers and DataGridView grid cells are filled with the keyboard and verified, just like in Win Set Value. The log records which field was written, never the text.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
selector | selector | — | The field to type into. |
text | string | credential | — | The text to type. Accepts a credential (credential("name")["field"]) without exposing its value. |
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. |
clear | bool | true | Clear the field before typing. With method = value the content is always replaced. |
method | string | value | Method: value (UIA Value pattern, fast) · simulate (simulates keystrokes). |
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 |
|---|---|
The element is outside the visible area and could not be scrolled into view, … | The field is hidden by its container’s scrolling. 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 fields; it won’t type into whatever has the focus. Add an anchor or an idx to the selector. |
The value is not a valid date. … / The date picker did not keep the date … | In a date picker. See Win Set Value. |
An empty value cannot be typed into a grid cell; … / The grid cell did not keep the typed value … | In a grid cell. See Win Set Value. |
Element not found with selector {…}. | See common errors. |
Example
Section titled “Example”Win Type selector = (field "User") text = credential("erp")["user"]Win Type selector = (field "Password") text = credential("erp")["password"]Win Click selector = (button "Sign in")Append text at the end of a field without clearing what it already has:
Win Key Press selector = (field "Remarks") keys = "ctrl+end"Win Type selector = (field "Remarks") text = " Reviewed." method = simulate clear = falseRelated activities
Section titled “Related activities”- Win Set Value — set a value directly (Value method only).
- Win Key Press — send special keys (Tab, Enter…).
- Win Get Text — read a field’s value.