← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #451773]: simulate human click() ?

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
the easiest solution is to click somewhere in a short distance around the center.
The distance can be randomized with the appropriate feature of Python.

something like that:

import random
match = wait(image)
x = random.randint(-5, 5)
y = random.randint(-5, 5)
click(match.getCenter().offset(x,y))

this would click randomly in a rectangle of 10x10 pixel around the
center of the matched image.

this is a showcase of possible values:
import random
for i in range(10):
  x = random.randint(-5, 5)
  y = random.randint(-5, 5)
  print "(%d, %d)"%(x, y)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.