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

    Status: Open => Answered

Roman Podolyan proposed the following answer:
> 1)how can we scroll the screen by the mouse event,if the screen is big
> it requires to scroll the screen up to botom of the screen.

I didn't use this for a while, but earlier I did this with low-level
mouse commands (worked for Windows Phone and iOS emulators).

Here is the example:

def drag_up():
        # setting begin - end
        x1, y1 = (640, 512)
        start = Location(x1, y1)
        stepX = 0 
        stepY = 10
        run = start
        #moving up
        mouseMove(start); wait(0.5)
        mouseDown(Button.LEFT); wait(0.5)
        for i in range(24):
                run = run.right(stepX).above(stepY)
                mouseMove(run)
                wait(0.1)
        mouseUp();


Of course, you may want other start/stop coordinates and vertical/horizontal 
step size, but the principle should be clear: 

1)      mouseMove(start);
2)      mouseDown(Button.LEFT)  #as we do when scrolling with physical mouse - 
pressing left button
3)      mouseMove(run) #moving mouse in cycle
4)      mouseUp();  #when done stop, "holding" left button


That's all needed to scroll or swipe/flick, I think.

For swipe/flick move I used slightly different cycle:

        for i in range(5):
                        run = run.right(stepX).above(stepY * i)
                        mouseMove(run)
                        wait(0.05)


To get more smooth movement with this commands set for them as lower time 
between mouse action as possible.

I used this:

Settings.MoveMouseDelay = 0.01

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

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to