click randomly on an image

Asked by rahidyll brito on 2018-08-31

I want to make a code that click on different x, y of the image
I tried to do it manually, on my own and it was a success, I made a variable with random numbers, and then I put some if, each if I had a different position of the selected image, I managed to have more than 30 random click, the problem is that if I want to do it for another image, it would take more than 1 hour to obtain the positions manually, I would like to know how I could do it

i'm using python
Sorry for my bad English, I hope you can help me

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
Manfred Hampl
Solved:
2018-08-31
Last query:
2018-08-31
Last reply:
2018-08-31
Best Manfred Hampl (m-hampl) said : #1

see comment #2 in https://answers.launchpad.net/sikuli/+question/665546

m = find(imageIwantToClick)
click(Location(random.randint(m.getX(),m.getX()+m.getW()),random.randint(m.getY(),m.getY()+m.getH())))

rahidyll brito (botter) said : #2

Thanks Manfred Hampl, that solved my question.