← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #694126]: make every click random on a picture

 

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

    Status: Open => Answered

TestMechanic proposed the following answer:
1. Define function

def RandomClick(element):
    m = find(element)
    click(Location(random.randint(m.getX(),m.getX()+m.getW()),random.randint(m.getY(),m.getY()+m.getH())))

2. Then you can use this function in your code

RandomClick("some_picture.png")

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