How can i set Dark/Light mode on iOS using appium

563 Views Asked by At

I have tried the below code block in @Before and nothing happens the test passed with no error but device mode did not change to dark

((JavascriptExecutor)driver).executeScript("mobile:setAppearance", "{style: 'dark'}");

1

There are 1 best solutions below

0
On BEST ANSWER

This command is an alias to the xcrun simctl ui command which is only applicable to the simulators.

The only way to do this on a real device is to open Settings -> Display & Brightness and click on Dark mode. You can see some details on this topic