← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #214750]: assert not exists keeps failing even though really doesn't exist

 

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

RaiMan proposed the following answer:
-- but still leaves me wondering why if your code can detect it fine why cant the simple assert not exist detect it.
you did not test this case in the "blurb" situation!

So do it again this way:

if exists("IDNew-2.png"):
    getLastMatch().highlight(3)
    assert exists("IDNew-2.png")
else:
    assert not exists("IDNew-2.png")

This should not give an assertion exception in any case you told above.

I do not see any sense to "workaround".
You have to understand and solve this, otherwise a bit later, you get another similar situation and again have to workaround.

The fact that it worked in the clinical situation above, only tells, that there is some problem in your real workflow. 
So make the tests with this real workflow.

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