I have a scenario where I have to rotate my simulator while xcode ui test is going.
To rotate the simulator, I use the below code
UIDevice.currentDevice().orientation
let value = UIInterfaceOrientation.LandscapeLeft.rawValue
UIDevice.currentDevice().setValue(value, forKey: "orientation")
but it is not working.
Is there any solution to rotate the simulator using Swift code in xcode ui test?
Have you tried this?
XCUIDevice.sharedDevice().orientation = .LandscapeLeft
XCUIDevice.sharedDevice().orientation = .Portrait
XCUIDevice.shared().orientation = .landscapeLeft
XCUIDevice.shared().orientation = .portrait
XCUIDevice.shared.orientation = .landscapeLeft
XCUIDevice.shared.orientation = .portrait
Swift 4:
XCUIDevice.shared.orientation = .landscapeLeft
XCUIDevice.shared.orientation = .portrait
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With