MultiSelect Action (ListBox Controls)

Applies to TestComplete 15.45, last modified on December 01, 2022
This method is not supported in web tests (including cross-platform web tests) that use XPath expressions and CSS selectors to locate web elements. This method can be only used in tests that locate web objects by using internal identification properties provided by TestComplete.

Description

Use the MultiSelect action to select several items in the specified list box control.

Declaration

TestObj.MultiSelect(Items)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
Items [in]    Required    Variant    
Result None

Applies To

The method is applied to the following objects:

View Mode

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

Parameters

The method has the following parameter:

Items

This parameter can be either of the following:

  • An array containing captions or indexes of items to select. You can use “native” JavaScript, JScript, Python, VBScript and DelphiScript arrays as well as arrays created using the CreateVariantArray function.
  • A string holding the captions of items to select, separated by the wListSeparator characters. The default list separator is the pipe character.

Item captions can contain wildcard characters - * and ?. The asterisk (*) corresponds to a string of any length, the question mark (?) - to any single character. Captions can be case-sensitive or case-insensitive depending on the value of the Use case-sensitive parameters project setting.

Result Value

None.

Remarks

In order for this action to execute successfully, the control must support multiselection. If an item is not found or the control does not support multiselection, MultiSelect fails and posts an error message to the test log.

  • Java Swing List: When you call the MultiSelect method, the previous selection is preserved. To deselect an item you should call SelectItem with the SelOption parameter set to False. To deselect all list box items, call SelectItem(-1, False).

  • Win32 ListBox: The list box must have the LBS_MULTIPLESEL or LBS_EXTENDEDSEL style. Items is a string containing the item names to be selected.

    If the list box style does not include LBS_MULTIPLESEL or LBS_EXTENDEDSEL, MultiSelect fails and posts an error message to the test log.

  • Chrome browser: TestComplete may fail to record the MultiSelect method for web controls in Chrome. It will record ordinary coordinate clicks instead. You can replace those clicks with the MultiSelect method in your tests manually.

Example

To view an example that demonstrates how to use the MultiSelect action, see Selecting Multiple List Box Items in Desktop Windows Applications.

See Also

Selecting a Single List Box Item in Desktop Windows Applications
ClickItem Action (ListBox Controls)
DblClickItem Action (ListBox Controls)
SelectItem Action (ListBox Controls)

Highlight search results