Home > Language Reference > UI Automation Functions > SelectUIAItem

SelectUIAItem

The SelectUIAItem function selects the specified item in a list/combo/tree specified by its UIA descriptor.

Usage

Used to click an item in a list/combo/tree whatever its position.

Video: How to use SelectUIAItem WinTask x64 function for automatically selecting data in a list, a combo and a treeview exposed to UI Automation framework, for example in a WinForms application.

Syntax

ret=SelectUIAItem(<uia_descriptor> , <item>)

Parameters

<uia_descriptor>, string, UIA descriptor of the UI element where to find the <item> within the desktop. Use Spy to find the UIA descriptor of the UI element.

<item>, string, text to select in the list of items.

Return value

Ret, optional numeric return code. If the function succeeds selecting within 30 seconds (this default value can be changed using #ActionTimeout), the function returns 0. If the function fails, the return value is a nonzero value (see UI Automation Functions Error Codes).

Remarks

Use Spy tool to find the UIA descriptor of the parent element (the listbox element containing all the items -do not spy one item but the parent element of all the items).

See also

How to use UI Automation functions
ClickUIA
GetUIAProperty
WriteUIA

Examples

'Select item Hydrogen in list view
 SelectUIAItem("[APP='WpfTestApp.exe'][ROLE='list view']","Hydrogen")

'Select item Customers in combo box'
SelectUIAItem("[APP='WpfTestApp.exe'][ROLE='combo box']","Customers")