Is there any way of quickening monkeyrunner script

2019-07-20 18:17发布

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条回答
来,给爷笑一个
2楼-- · 2019-07-20 18:34

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.

查看更多
登录 后发表回答