iOS simulator: scroll/drag with mouse and keyboard

Asked by Liron Yahdav

ALT and SHIFT-ALT are needed additionally:
http://stackoverflow.com/a/13275908/62

example:
switchApp("Simulator")
keyDown(Key.SHIFT + Key.ALT)
dragDrop("1494036114166.png", "1494036120150.png")
keyUp(Key.SHIFT + Key.ALT)
---------------------------------------------------------------------------------

I am trying to follow http://sikulix-2014.readthedocs.io/en/latest/region.html#Region.dragDrop to write a script that will scroll to the bottom of a list in the iOS simulator but I can't get it to scroll. I tried tweaking delay settings mentioned in the docs, but it didn't help.

I can get dragging to work fine outside the simulator.

Any ideas?

Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

explode it to the basic mouse features
mouse.Down()
mouse.Up()
mouse.Move()

then you have more options to insert appropriate waits and then create your own swipe function.

Revision history for this message
Liron Yahdav (lyahdav) said :
#2

I tried this but I still can't get it to work. I have an example script, but is there a way to attach files here? I can't find a way.

Here is my script without images:

switchApp("Simulator")
hover("1493773337554.png")
wait(1)
mouseDown(Button.LEFT)
wait(1)
hover("1493773366436.png")
wait(1)
mouseUp(Button.LEFT)

The images are two different rows in the Settings app.

Here is a GIF of the script playing:
http://i.imgur.com/qrzJp0W.gif

Revision history for this message
RaiMan (raimund-hocke) said :
#3

you should search the images before the scroll and use the match:

switchApp("Simulator")
start = find("1493773337554.png")
target = find("1493773366436.png")
mouseMove(start)
wait(0.3)
mouseDown(Button.LEFT)
wait(0.3)
mouseMove(target)
wait(0.3)
mouseUp(Button.LEFT)

Revision history for this message
Liron Yahdav (lyahdav) said :
#4

I tried that but same issue:
https://media.giphy.com/media/l1BgSSCPCqq4cxFQc/giphy.gif

I added some additional hacks (holding down Shift+Alt keys which mimics two finger drag http://stackoverflow.com/a/13275908/62) and now it works:
switchApp("Simulator")
start = find("1493773337554.png")
target = find("1493773366436.png")
mouseMove(start)
wait(0.3)
keyDown(Key.SHIFT + Key.ALT)
mouseDown(Button.LEFT)
wait(0.3)
mouseMove(target)
wait(0.3)
mouseUp(Button.LEFT)
keyUp(Key.SHIFT + Key.ALT)

It would be nice if there was a way to get it working without the hacks. If I do the drag manually it works fine, so I still think something is wrong with Sikuli.

Revision history for this message
Liron Yahdav (lyahdav) said :
#5

Interestingly enough, with the hack of holding down Shift+Alt, this also works (much less code):
switchApp("Simulator")
keyDown(Key.SHIFT + Key.ALT)
dragDrop("1494036114166.png", "1494036120150.png")
keyUp(Key.SHIFT + Key.ALT)

Revision history for this message
Best RaiMan (raimund-hocke) said :
#6

Thanks for finding (again ;-)

Has nothing to do with SikuliX though.

Revision history for this message
Liron Yahdav (lyahdav) said :
#7

Thanks RaiMan, that solved my question.