click not working --- click timing might be the problem --- workaround

Asked by nick oh

************************* workaround

play with the timing of a click according to comment #2

-----------------------------------------------------------------------------------
I know this exact same question has been asked a milion times, but hear me out :

I'm trying to click some buttons using Sikuli 1.1.2 running on Admin by using sudo on Terminal.
OS : MacOS High Sierra 10.13.5
Program I'm clicking on : Bluestacks 2.0.0

I've tried click(), doubleClick(), hover(img) then click(), define region and click region, run on user and run using sudo, everything.
The click()s sometimes work and when it does it will work until that session is terminated.
But when it does not, however, sikuli will say that it did click but the clicks are not actually registered on the bluestacks screen.
And no, I use switchApp("Bluestacks") at the start of the code and it focuses properly.

Is it because of something funky going on with Bluestacks? with Sikuli? or with MacOS? Or am I just bad at coding and messed up?
Any help is appreciated, I don't think I have much time.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
Best RaiMan (raimund-hocke) said :
#1

IMHO on macOS nothing changes when you run SikuliX from a Terminal with sudo.

Bluestack is a game framework and surely has some specialities about how things are handled in the triangle macOS, Java AWT Robot (which does the clicks) and Bluestack.

So before doing any complex workflows, you should clarify and track down the basics.
Sort out the situations where it does not work and do some debugging/testing around this situation.

The current implementation does not have any knowledge about wether a click did what it should, there is no feedback.
So it is only possible to check the screen about wether it changed with the click as it should.

Revision history for this message
nick oh (xygen) said :
#2

SOLVED :

I used the following code to basically 'click longer' and allow Bluestacks to take its time registering inputs.

def clicc():
  wait(0.3)
  mouseDown(Button.LEFT)
  wait(0.2)
  mouseUp()
  wait(0.2)

~stuff~

hover(image)
clicc()
hover(image)
clicc()
...

Revision history for this message
nick oh (xygen) said :
#3

Thanks RaiMan, that solved my question.

Revision history for this message
RaiMan (raimund-hocke) said :
#4

@nick
yep, well done ;-)

I missed that possibility in my answer. So thanks for feedback.