quiel
quiel

Reputation: 427

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

Upvotes: 6

Views: 1870

Answers (2)

Brian Cooley
Brian Cooley

Reputation: 11662

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.

Upvotes: 2

thecoshman
thecoshman

Reputation: 8650

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

Upvotes: 1

Related Questions