Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set Xcode simulator to programmatically rotate to landscape for iPhone/iPad through Selenium

Looking at the Appium log it is saying that it is in landscape mode, and landscape shows up in the desired capabilities e.g.:

[debug] [XCUITest] Setting initial orientation to 'LANDSCAPE'

Currently doing this to set this:

descap.setCapability("orientation", "LANDSCAPE");

Doing this I am able to get the app to show up in landscape. But how to get the XCode simulator device to display in landscape?

Using Java and Selenium, how do I tell Appium/XCode simulator to display the device in landscape mode? Thanks!

like image 516
Wes Avatar asked Aug 02 '18 18:08

Wes


Video Answer


1 Answers

To display the device in landscape mode you can use the following line of code:

descap.setCapability("--main-frame-resizes-are-orientation-changes", "landscape");

Note: Ensure that descap is an instance of ChromeOptions() class.

like image 56
undetected Selenium Avatar answered Oct 20 '22 00:10

undetected Selenium