问题
While using appium to test mobile application coded in Angular JS with protractor how can we change simulator orientation to landscape mode?
I have added : 'deviceorientation': 'landscape',
in config.js
file.
But it didn't change when i run it.
回答1:
I solve it with uppercase in capabilities in the config file :
'orientation': 'LANDSCAPE'
also with this option it is working :
'deviceorientation': 'LANDSCAPE'
回答2:
Using server capabilities :
orientation - (
Sim/Emu-only
) start in a certain orientation - LANDSCAPE or PORTRAIT
and also as suggested by @Shekhar Swami using the code you can perform an action like :
(AppiumDriver)driver.rotate(ScreenOrientation.LANDSCAPE);
回答3:
Use this method for landscape mode:
public void rotateDeviceScreenToLandscape() {
((Rotatable) driver).rotate(ScreenOrientation.LANDSCAPE);
}
回答4:
In my case it switches the mode but device remains the same (vertically oriented). To fix that - go to Simulator window - Device - Rotate
来源:https://stackoverflow.com/questions/37167082/while-using-appium-how-can-we-change-device-orientation-to-landscape-mode