问题
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