Image not found although image was used 2 times before

Asked by RG

HI,

I run a sikuli script which enters a 3 digit code via a keyboard which is displayed as a image (like a calculator)

I check whether the keyboard image exist - if exists I click 3 times at the number 2 at the image. Sometimes it happens that the script stops because he didn't find the image for the second or third click at number 2.

The image is in all 4 steps the same (the whole keyboard, but with different click offset). So, what can be that the image is found with "exist", the next click on this image works fine, but the second click of the same image failed ("Image not found...")?

Can anybody help?

R

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
RaiMan (raimund-hocke) said :
#1

show a screenshot and your relevant code.

Revision history for this message
RG (rudolf-groetz) said :
#2

Hi RaiMan,

The first click on gdfg.png works, the second failed.

Thanks for help
R.

 if exists (Pattern("EnterCWwithm.png").similar(0.90)):
      scanOK = "9"
      writeErrorLog (logFile, "*** keyboard found")
      screenCopy (imagePath + e + '-09-keyboard.jpg')
      #click (Pattern("EnterCWwithm.png").similar(0.97).targetOffset(-11,-28))
      click(Pattern("gdfg.png").similar(0.98))
      screenCopy (imagePath + e + '-09-keyboard0201.jpg')

      #wait (2)
      click(Pattern("gdfg.png").similar(0.98))
      screenCopy (imagePath + e + '-09-keyboard0202.jpg')

      #wait (2)
      click(Pattern("gdfg.png").similar(0.98))
      screenCopy (imagePath + e + '-09-keyboard0203.jpg')

      wait (2)
      click("Finish.png")

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

I guess, the number 2 slightly changes its outfit, when hovered.

use click(getLastMatch()) the second and third time, supposing the number 2 does not move.

Revision history for this message
RG (rudolf-groetz) said :
#4

Thanks RaiMan, that solved my question.