← Back to team overview

sikuli-driver team mailing list archive

[Question #213497]: Unchecking all checked check boxes from two similar region is behaving differently

 

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

Hi,

I'm seeing a weird behavior.  I have 5 checked checkboxes that I need to uncheck in two different views.  The first view, I somehow got it to work and here is the code that is working.

#test_20 - Test for the Summary Bar graph check boxes to see if disabling works
    @unittest.skip("Skipping for Now!")
    def test_20VerifySummaryBarGraphDisableALLUnit(self): 
        getLastMatch().highlight(2)
        SummaryBarGraphCheckBoxesRegion = Region(381,419,376,25)
        if SummaryBarGraphCheckBoxesRegion.exists:
            #uncheck all the check boxes to show empty summary bar graph.  Verification of the check boxes
            counter = 0
            while (counter < 5):
                if SummaryBarGraphCheckBoxesRegion.exists(Pattern("CheckedCheckBox.png").similar(0.93)):
                    click(SummaryBarGraphCheckBoxesRegion.getLastMatch())
                    wait(1)
                #else:
                    #popup("Can't find the checked check boxes on the region")
                counter = counter + 1
        else:
            popup("The region of check boxes does not exist")
        assert (exists(Pattern("EmptySummaryBarGraphUnit.png").similar(0.95)))

Now I am using the same code in a different testing view and the checkboxes look exactly the same but it's not working.  At similarity level 75 percent, I get 7 matches one of them being red box and other being the blue box.  In the first code I had to raise the similarity level to 93 percent to exclude red and blue box and just match the 5 checked check boxes.  However, in my second situation, I can't do this because at 93% similarity level, I only have one matching checked box and if I reduce it to about 85%, it's including the red box which has higher similarity level than the checked check box.

Here is my code for the second situation:
#test_60 - Test for the Summary Bar graph check boxes to see if disabling works
    #@unittest.skip("Skipping for Now!")
    def test_60VerifySummaryBarGraphDisableALLUnitForDollar(self): 
        getLastMatch().highlight(2)
        SummaryBarGraphCheckBoxesRegion = Region(392,416,360,19)
        if SummaryBarGraphCheckBoxesRegion.exists:
            #uncheck all the check boxes to show empty summary bar graph.  Verification of the check boxes
            counter = 0
            while (counter < 5):
                if SummaryBarGraphCheckBoxesRegion.exists("CheckedCheckBoxDollar.png").similar(0.93)):
                    click(SummaryBarGraphCheckBoxesRegion.getLastMatch())
                    wait(1)
                #else:
                    #popup("Can't find the checked check boxes on the region")
                counter = counter + 1
        else:
            popup("The region of check boxes does not exist")
        assert (exists(Pattern("EmptySummaryBarGraphDollar.png").similar(0.95)))

I even tried recapturing the image for the checked box and still redbox has higher similarity level. 

I am attaching four screenshots units view and dollar view with respective regions I created to select the checkboxes.
https://www.dropbox.com/sh/dk2it0o2so8fso5/hlRe6raDv8

Any suggestions would be huge help.  I know one alternative is to not use the loop and just pick 5 different regions for each check box but this makes my code very long and I want to avoid it if possible.

Thanks,

Alex Yi



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