Weird rsults for the same image comparison using sikuli

Asked by Shilpi Gupta

I am using Sikuli in Automation project. Using Selenium for functional testing. And using Sikuli for GUI comparison. After taking snapshots I am am comparing snapshots with previously taken images. Some times Sikuli gives Pass and second time its giving fail.

I am taking snapshots through Java API not Selenium.

One more issue I am facing, One image I am comparing with four screens and its passing with three screens but failing with fourth one. Parts of the image which I am comparing is same in all four screens.

I am using everywhere finder object and using finder.find to compare given images.

Why this weird results for the same image comparison? Do I need to set some settings before screen comparison.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

I suppose, you are Programming in Java?

-- taking snapshots through Java API
I suppose you are using Java Robot?

-- Parts of the image which I am comparing is same in all four screens.
not really clear what that means?
I guess: SOME of the images are same .... ???

-- One image I am comparing with four screens
not really clear:
live-comparing on a four screen multi monitor system or screenshots from 4 different systems??

Are you using the similarity feature?

Revision history for this message
Shilpi Gupta (shilpi-gupta2) said :
#2

Thanks! for responding RaiMan,

yes I am programming in Java. And I am using robot to capture a screenshot.
I am doing a Multibrowser automation. My script will run on 3 browsers sequentially on same syatem.

Yes I tried both finder.find() method and Screen objects and pattern objects.

Using Finder object : I am trying something like this:

            String filePath ="drive path";
            function.Snapshot.Capture(filePath +"\\" +testCaseName+"_HomePageScreen"+".png"); // take the screen shot at run time and store in the drive
           String imgPathName = filePath +"\\" +testCaseName+"_HomePageScreen"+".png";
           finderObj = new Finder(imgPathName);
           finderObj.find("HeaderButtons.png",0.80); // Header.png image I am searching at Homepage screen with 80% ratio
            if (finderObj.hasNext()){
                 LOGGER.info("HeaderButtons : "+ browserName + " - Pass!");
            }else {
                  LOGGER.info("HeaderButtons :"+ browserName + " - Fail");
            }

Using Screen and Pattern object I tried this:-

// Navigate to that screen where we want to do comaprison
                 Pattern p1__s3_HeaderButton = new Pattern("Header.png "); // holds the drive path where pattern image exists
                 Screen screen = new Screen();

                  if(screen3.exists(p1__s3_HeaderButton.similar((float)0.80))!= null){
                          LOGGER.info("p1__s3_HeaderButton "+ browserName + " - Pass!");
                  }
                 else{
                          LOGGER.info("p1__s3_HeaderButton "+ browserName + " - Fail!");
                  }

Both the ways I am getting same results. I believe internally both finder.find() and pattern.similar() method call the same function.

My question was actually the image which I am comparing with all browsers is exacltly same. But why its failing I don't know reason for that. I am trying to find out something by doing variation in ratio.

Thanks,
Shilpi

________________________________________
From: <email address hidden> [<email address hidden>] on behalf of RaiMan [<email address hidden>]
Sent: Friday, July 06, 2012 5:45 PM
To: Shilpi Gupta (WT01 - ENU)
Subject: Re: [Question #202419]: Weird rsults for the same image comparison using sikuli

Your question #202419 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/202419

    Status: Open => Needs information

RaiMan requested more information:
I suppose, you are Programming in Java?

-- taking snapshots through Java API
I suppose you are using Java Robot?

-- Parts of the image which I am comparing is same in all four screens.
not really clear what that means?
I guess: SOME of the images are same .... ???

-- One image I am comparing with four screens
not really clear:
live-comparing on a four screen multi monitor system or screenshots from 4 different systems??

Are you using the similarity feature?

--
To answer this request for more information, you can either reply to
this email or enter your reply at the following page:
https://answers.launchpad.net/sikuli/+question/202419

You received this question notification because you asked the question.
Please do not print this email unless it is absolutely necessary.

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

www.wipro.com

Revision history for this message
RaiMan (raimund-hocke) said :
#3

-- yes the methods used internally to find an image or a pattern are the same

-- same image different browsers
since the browsers use different rendering engines (Safari/Chrome - webkit, FF - native, IE - native, ...) there might be differences on the pixel level especially with css-styled GUI elements (e.g. a button with css-styled border and shadow) with the same GUI-element in different browsers.
Soit might well be, that an image taken in IE does not match at all (similarity does not matter here really), because of major pixel-based references.
I once evaluated such a case, by taking a shot of the same element in different browsers and comparing the pixels visually with an image viewer magnified, so each pixel was visible.

Revision history for this message
RaiMan (raimund-hocke) said :
#4

Uuups, conclusion:

In many cases you need an image (sub) set for each browser.

Can you help with this problem?

Provide an answer of your own, or ask Shilpi Gupta for more information if necessary.

To post a message you must log in.