← Back to team overview

sikuli-driver team mailing list archive

[Question #210742]: if exists and assert exists are not behaving same

 

New question #210742 on Sikuli:
https://answers.launchpad.net/sikuli/+question/210742

Hi,

To give a short background on what I'm trying to: I have list of datasets that I need to pick from a selector window.
Basically, I need to make sure that there is a dataset called "39W Anchor#Base Scenario 20110926".  If this dataset happens to be at the top of the list then by default it is already selected meaning the image will be in black.  Anywhere else, it will appear in white image.

So I have the following code:
if exists(Pattern("39W Anchor Loadset Unselected Version.png").similar(0.99)) or exists(Pattern("39W Anchor Loadset Selected Version.png").similar(0.99)):
            getLastMatch().highlight(2)
            #print getLastMatch()
            hover(getLastMatch())

This works.  Selects the image that I want.  Now at the end I do an assert exists for either one of them and following is the code:
assert (exists(Pattern("39W Anchor Loadset Unselected Version.png").similar(0.99)) or exists(Pattern("39W Anchor Loadset Selected Version.png").similar(0.99)) 

This fails for some reason.  I have to lower the similarity level down to 95 percent to make this work but then if I do that, then when I have a dataset called "39W Anchor#Base Scenario 20110919", it will pass and then select this wrong dataset. 

Am I using the assert statement wrong?

Thank you,

sincerely,

Alex Yi

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