Is there any way of quickening monkeyrunner script execution?

淺唱寂寞╮ 提交于 2019-12-11 04:32:27

问题


I've got a particular monkeyrunner script (in Jython), which I use for taking screenshots or touching particular coordinates. My main program is written in Perl - it just executes monkeyrunner scripts when their functionality is need.
The problem is in slowness of such method: every time in monkeyrunner script I should get a MonkeyDevice object and work with it:

device = MonkeyRunner.waitForConnection()

And the whole operation seems to take from 5 to 9 seconds, which is very slow for my program.
Is there any way of working (at least, touching coordinates) more quickly?
Thank you.


回答1:


Instead of restarting MonkeyRunner each time you need to run a script you could run it in a sub process and use normal python functions (such as raw_input) to have it wait until you need to do something.

This will save you the overhead of restarting MonkeyRunner each time you need to do something. You could probably even use this method to feed MonkeyRunner the actions that you are trying to do.



来源:https://stackoverflow.com/questions/10418156/is-there-any-way-of-quickening-monkeyrunner-script-execution

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