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