1

In UITest, I have tried to check the device screen size, but this code doesn't get correct size.

let boundsHeight = UIScreen.main.bounds.size.height

When I try with above code on Xcode simulator, boundsHeight is 480 each time, regardless of the device even though it should be 568 with iPhone SE.

What causes UITest not to get the size correctly?

m29
  • 11
  • 1
  • Does this answer your question? [How to get the screen width and height in iOS?](https://stackoverflow.com/questions/5677716/how-to-get-the-screen-width-and-height-in-ios) – Yeheshuah Mar 17 '20 at 06:28
  • 1
    I have got correct screen size with following code. `let frame = XCUIApplication().windows.element(boundBy: 0).frame.size` – m29 Mar 17 '20 at 06:48

0 Answers0