Switch Action (Specific to iOS Switch Controls)

Applies to TestComplete 15.63, last modified on April 10, 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.


Switch controls in iOS applications can take two states: On or Off. Use this action to specify the desired state of the control.

The action compares the current state of the control and the desired state specified via the input parameter: if the state mismatches, the action performs a single touch over the control; otherwise, it performs no action.

Note: To obtain the current state of the control, use its wState property.



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

Applies To

The method is applied to the following object:

View Mode

This method is available in the Object Browser panel and in other panels and dialogs in both Basic and Advanced view modes.


The method has the following parameter:


Specifies the state to be set.

Possible values:

Value Description
True or "On" The control is on.
False or "Off" The control is off.

Result Value



To view an example that demonstrates how to use the Switch method, see Changing the Switch State.

See Also

Testing iOS Applications (Legacy)
Touch Action (Mobile Objects)
Changing the Switch State

Highlight search results