Related to XCTest UI Testing - How to close and open an app without relaunch? is there any way to lock the screen from a UI test? XCUIDevice.Button
only has three cases, home, volume up and volume down.
Asked
Active
Viewed 259 times
0

Ilias Karim
- 4,798
- 3
- 38
- 60
1 Answers
1
XCUIDevice has a private method for this. Shh, it's kinda secret.
XCUIDevice.shared.perform(NSSelectorFromString("pressLockButton"))

Mike Collins
- 4,108
- 1
- 21
- 28