Question

I am having trouble using drag and drop with Sikuli. I would like to drag something in any other direction (up, down, left, right) for a fixed number of pixels.

This looks like it should work:

t = find("1325249963143.png")
dragDrop(t, [t.x + 100, t.y + 100])

Sikuli IDE log says

[log] DRAG (741,525) to null

but the element is not dragged.

This works just fine:

dragDrop("1325249963143.png", "1325251471990.png")

The log says

[log] DRAG (741,525) to (507,490)

What am I doing wrong?

Environment: Mac OS X 10.7.2, Sikuli X-1.0rc3 (r905)

Was it helpful?

Solution

only to say hello here - an alternative coding:

dragDrop(t, t.offset(Location(100, 100)))

OTHER TIPS

To quote RaiMan (raimund-hocke):

the first parameter is a Match object, which is ok. the second prameter must be of type PSMRL too (see docs: Pattern/Image, String, Match, Region or Location)

dragDrop(t, Location(t.x + 100, t.y + 100))

I use this code to drag an image down to a given location:

image1 = ("image1.png")
imageLoc = find(image1)
dragDrop(imageLoc, Location(imageLoc.getX() + 100, imageLoc.getY() + 100))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top