Drag and drop with Sikuli

北战南征 提交于 2019-12-06 03:20:13

问题


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)


回答1:


only to say hello here - an alternative coding:

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



回答2:


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))



回答3:


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))


来源:https://stackoverflow.com/questions/8679929/drag-and-drop-with-sikuli

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!