SelectItem Action (Android Controls)

Applies to TestComplete 15.69, last modified on November 13, 2024
This method is available in legacy mobile tests that work with devices connected to the local computer. To learn how to simulate user actions in newer cloud-compatible mobile tests, see the Simulating user actions in tests section.

Description

Use the SelectItem action to select the specified item in the control.

Declaration

TestObj.SelectItem(Items, SelOption)

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    
SelOption [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.

Parameters

The method has the following parameters:

Items

Specifies the caption or zero-based index of the desired item. The caption could contain asterisk (*) or question mark (?) wildcards or regular expressions. The asterisk corresponds to a string of any length, the question mark corresponds to any single character. 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 you enter -1, all items will be selected or deselected.

SelOption

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

None.

Remarks

If Item is -1, all the items will be selected or unselected. But if the control does not support multiselection, SelectItem will fail and post an error message to the test log.

If the specified item was not found, an error message is posted to the test log.

Example

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

See Also

Testing Android Applications (Legacy)
Selecting List View Items
MultiSelect Action (Android Controls)
CheckItem Action (Android Controls)
Touch Action (Mobile Objects)
TouchItem Method (Mobile Controls)

Highlight search results