← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #234435]: After launching the application how do I swipe right/left on an android emulator?

 

Question #234435 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/234435

    Status: Open => Answered

Roman Podolyan proposed the following answer:
Using low-level mouse routines, you can write yourself swipe the way you
needed.

Here is example of my quick and dirty right swap routine.

def drag_right():
        # setting begin - end
        x1, y1, x2, y2 = (640, 512, 640, 412)
        start = Location(x1, y1)
        end = Location(x2, y2)

        # moving left
        stepX = 10
        stepY =  0
        run = start
        mouseMove(start); wait(0.5)
        mouseDown(Button.LEFT); wait(0.5)
        for i in range(20):
                run = run.right(stepX).above(stepY)
                mouseMove(run)
                wait(0.1)
        mouseUp()


So, basically: 
1) Move mouse to where you want to start a swipe
2) Mouse down
3) Use mouseMove in cycle to to the swipe 

Wwhen I did quick flick I increased run in the cycle like this: 
        for i in range(5):
                        run = run.right(stepX*i).above(stepY)
                        mouseMove(run)
                        wait(0.05)

Notice that stepX*i — that means that 1st move will be 5 pixels, next
10, then 15 and so on, increasing mouse speed.


Using routines like that, I implemented all the swipes I needed. 
 
Hope that will help you too.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.