How to Flick using monkeyrunner? not just Drag
Asked Answered
B

2

6

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

Ba answered 1/3, 2012 at 5:12 Comment(2)
Looks like nobody knows the answer to this one - even with a bounty on it!Revelation
We cannot replicate the pressure using Monkeyrunner so we cannot do the flick. Just dragging is only way we have for nowBa
C
2

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.

Carnegie answered 20/3, 2012 at 13:50 Comment(0)
L
1

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

Lethia answered 20/3, 2012 at 13:41 Comment(1)
We cannot replicate the pressure using Monkeyrunner so we cannot do the flick. Just dragging is only way we have for now.Ba

© 2022 - 2024 — McMap. All rights reserved.