← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #245849]: exists() but cannot click()

 

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

Ray Bobak posted a new comment:
The only real way to prove that the image changed would be to capture
the screen at end of while loop and before the click.  I have been
unable to locate methods to accomplish the captures which was one reason
I posted this incident.  I have seen repeats of this behavior in other
sections of code.  The application that I am manipulating does not
update its image except in reaction to events such as keystrokes or
mouse clicks so while one can claim that the image must have changed, I
am reluctant to believe it given how the application behaves.  And
without a method to capture the screen, I cannot provide evidence to
convince myself that the screen changed.  In addition, I have seen
similar code fail with a different application that updates the screen
even less frequently than the one referenced in this report.

    mainWin.click("1392777214447.png") # click on accept to proceed with install in Google play store
    mainWin.wait("1395278354165.png",60) # wait for proceed message to use wifi to download large app
    print 'click proceed to use wifi'
    mainWin.click("1395278354165.png") # click on proceed

this is a code segment that failed in similar manner, the wait was for
the warning message that were download a very large app and to proceed
using wifi only.  In the failure I saw, the second click failed after
the wait was successful.  The screed at time of the failure clearly had
the proceed button.

I was unaware that click() cated on the last exists() or find() that
occurred as that behavior was not documented in the Sikuli
documentation.  That simple fact will speed up my code significantly.
Thanks for that tip.

I agree that searching screen can take a while so I have been converting
code to limit search areas.  My current methodology to increase speed
has been to define regions at location where particular images will
appear and check for those images in regions the same size as the image.

aButton = find("abutton.png")

:
:
:
if aButton.exists("abutton.png"):
    #button is there click it
    aButton.click()

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