I'm a newbie when it comes to Swift and UITesting. I have a test case that must turn off the internet connection of the device but since I can't do that, I tried to access the control center by swiping the bottom most element available in the app
let app = XCUIApplication()
app.buttons["Device"].swipeUp()
app.buttons["Device"].swipeUp()
Now that shows the control center, but when I try to click the airplane mode or the Wi-Fi button, it fails.
app.otherElements["Airplane Mode"].tap()
app.otherElements["Wi-Fi"]
Please help me how to do that or if not, a workaround to turn on or off the internet connection of my device, thanks!