How I can emulate screen rotation with monkeyrunner with Android emulator?

本小妞迷上赌 提交于 2019-12-11 02:52:13

问题


I use monkeyrunner script for testing APK with GenyMotion emulator at Windows. Is it possible that script rotate emulated device?


回答1:


Thanks Nir H.

I have created in the same folder with script - rotate.bat with this code:

"c:\Program Files\Genymobile\Genymotion\genyshell.exe" -c "rotation setangle %1"

and call it from monkeyrunner as (example of rotate 90 degree and rotate it back):

...

print "rotation 90"
res = os.popen('rotate 90').read()
print res

MonkeyRunner.sleep(1)

print "rotation 0"
res = os.popen('rotate 0').read()
print res

...

and its works! :)




回答2:


I'm not familiar with Monkeyrunner, but if it's possible to run a CMD line via Monkeyrunner you can run the following command:

For horizonatal:

%Your_Genymotion_installation_path%\genyshell -c "rotation setangle 90"

For vertical:

%Your_Genymotion_installation_path%\genyshell -c "rotation setangle 0"


来源:https://stackoverflow.com/questions/28516890/how-i-can-emulate-screen-rotation-with-monkeyrunner-with-android-emulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!