Abinash Sahoo
Abinash Sahoo

Reputation: 87

Changing the on/off state of UISwitch element in XCTest

I have an UISWITCH element which is from a 3rd party application. I need to write test cases where i have to modify the state of the above switch element.

i have followed this From an XCUITest how can I check the on/off state of a UISwitch? but here i can only check the state of the Switch.

Is there any possibility where i can change the state of the UISwitch element from XCUITest.

Upvotes: 0

Views: 1636

Answers (1)

Roman Zakharov
Roman Zakharov

Reputation: 2273

Just tap switches to change their state.

app.cells["Wi-Fi"].switches.element.tap()

Upvotes: 2

Related Questions