SelectItem Action (Specific to XULListBox Controls)

Applies to TestComplete 15.65, last modified on June 26, 2024


Use the SelectItem action to select an XUL list box item specified either by its index or caption.


TestObj.SelectItem(Item, Select)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
Item [in]    Required    Variant    
Select [in]    Optional    Boolean Default value: True   
Result None

Applies To

The method is applied to the following object:

View Mode

To view this method in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.


The method has the following parameters:


Specifies the caption or zero-based index of the desired item.

The caption can contain asterisk (*) or question mark (?) wildcards or regular expressions. The asterisk corresponds to a string of any length (including an empty string), the question mark corresponds to any single character (including none). To specify more complicated parts of a caption, use regular expressions.

The caption can be case-sensitive or case-insensitive depending on the value of the Use case-sensitive parameters project setting.

If the control supports multiselection, you can enter -1 to select or deselect all items.


Specifies whether the item will be selected or deselected.

Value Description
True, or 1 The Item will be selected.
False, or 0 The Item will be deselected.

Result Value



Unlike ClickItem or DblClickItem, SelectItem does not move the cursor. It sends selection messages to the control.

See Also

XUL Listbox Support
Selecting a Single List Box Item in Desktop Windows Applications
ClickItem Action (ListBox Controls)
DblClickItem Action (ListBox Controls)
MultiSelect Action (ListBox Controls)

Highlight search results