Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Flick using monkeyrunner? not just Drag

I am trying to automatically scroll the browser using monkeyrunner. So far I can scroll by "Drag" event, but how can I scroll by "Flick". I appreciate if you can give me some hits or instructions.

Using drag:

for i in range(1, 40):
   device.drag((400,700),(400,300),0.15,1)
   MonkeyRunner.sleep(.7071)

edit

We cannot replicate the pressure using Monkeyrunner so we cannot do the flick. Just dragging is only way we have for now

like image 461
quiel Avatar asked Mar 01 '12 05:03

quiel


2 Answers

MonkeyDevice.java doesn't have any flick method in it, but you can adjust the duration parameter to drag, which appears to be the third argument. A fling is basically a very quick drag, so perhaps by reducing the duration to a very small number (0.01, maybe?) you can get the emulator or device to respond to a fling.

like image 169
Brian Cooley Avatar answered Nov 06 '22 21:11

Brian Cooley


As a work around, why not just 'drag' it many times?

It may take a little bit of work, but you should be able to reproduce the flick effect by performing lots of little drags.

Sorry I can't provide much more then that

like image 23
thecoshman Avatar answered Nov 06 '22 22:11

thecoshman