← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #201531]: Unable to click in random location based on image search.

 

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

Roman Podolyan proposed the following answer:
#-------------------
import java.util.Random
import random

def x():
    random.randint(0,10)

b = wait("1340345219668.png")
click(b.getCenter().offset(x,x))
#-------------------

I don't see any assignment of "x" variable. So the Jython gives you
right error: "x" should be initialized by integer number.


You may try it this way (two variables, X and Y): 
#------------
x = random.randint(0,10)
y = random.randint(0,10)
b = wait("1340345219668.png")
click(b.getCenter().offset(x,y))
#-----------

This code works for me in Sikuli.

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