Ilias Karim
Ilias Karim

Reputation: 5371

XCTest UI Testing - How to lock the screen?

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.

Upvotes: 1

Views: 349

Answers (1)

Mike Collins
Mike Collins

Reputation: 4549

XCUIDevice has a private method for this. Shh, it's kinda secret.

XCUIDevice.shared.perform(NSSelectorFromString("pressLockButton"))

Upvotes: 2

Related Questions