|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
|TestObj||A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section|
The method is applied to the following object:
The method has the following parameter:
Specifies the state to be set.
|True or "On"||The control is on.|
|False or "Off"||The control is off.|
To view an example that demonstrates how to use the
Switch method, see Changing the Switch State.