← 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

RaiMan proposed the following answer:
--- things are even stranger now. none of the files listed for captured images exist.
these temp image files are purged at script termination.

To preserve them you need extra code

def myCap(msg, reg = SCREEN):
     import shutil
     cap = capture(reg)
     print msg, cap
     shutil.move(img, "absolute-path-to-safe-place-" + msg + ".png") # msg should not contain blanks or other special character

now instead of e.g.
beforeInstall = capture(mainWin)
print 'mainWin captured before install to',beforeInstall

use
myCap("mainWin_before_install", mainWin)


--- the exists on 627 should have failed
exists() cannot "fail", it simply returns the match if successful or null otherwise. So to know about the result of an exists, you have to check the return value
if exists(): print "found"
else: print "not found"

--- the lastmatch did not change from previous value!
this is by definition: only a find success changes the value, which is helpful in some situations (multiple exists on same region)

If you produce a log with -d 3, I would prefer to get a file instead of
the paste here (silently malt o my mail at https://launchpad.net
/~raimund-hocke)

BTW: what happens, if you isolate the above snippet into a separate
script, drive your app manually to that point and then run the script?

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