Win List Items
Win List Items
Section titled “Win List Items”Type: win-list-items · Package: Desktop Activities v1.0.8 · Output: string[]
Returns all the items available in a ComboBox or list. Useful to know the options before choosing, to validate that the one you want exists, or to go through every option.
How it works
Section titled “How it works”It locates the control by its selector (waiting up to timeout). If it is a drop-down combo box, it opens it, waits 200 ms for the options to show, reads each item’s text and closes it again. In a plain list it reads the items directly. In Java applications the options are read through the Swing bridge.
It doesn’t change the selected option.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
selector | selector | — | The ComboBox or list. |
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. |
timeout | number | 30000 | Maximum ms to wait for the control. Empty = the project’s UI timeout or, if not set, 30000. |
Output
Section titled “Output”Returns a string[] (array of texts) with each item’s text, in the order they appear. If the control has no items, it returns an empty array (not an error). The position of each text in the array (starting at 0) is the same one item accepts in Win Select.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
Element not found with selector {…}. | See common errors. |
The Java control could not be located unambiguously, so nothing was done. … | In a Java app there are several identical combo boxes. Add an anchor or an idx to the selector. |
If a combo box loads its options slowly when opened, the array may come back incomplete or empty: open it first with Win Click and wait for an option with Win Wait For.
Example
Section titled “Example”Check that an option exists before selecting it:
Win List Items selector = (combo "Warehouse") → output: warehousesIf condition = warehouses.Contains("Main") └─ then: Win Select selector = (combo "Warehouse") item = "Main"Go through every option:
Win List Items selector = (list "Reports") → output: reportsFor Each items = reports itemVariable = report └─ activities: Log message = "Available: " + reportRelated activities
Section titled “Related activities”- Win Select — select one of the items.
- For Each — go through all the items.