compare two highcharts images doesn't work

Asked by jessica xu

I want to compare a local image with the current screenshot.
Here is my code:
BufferedImage bf = screen.capture().getImage();
Finder comp = new Finder(bf);
comp.findAll(new Pattern("localimagepath"));
 if(comp.hasNext()){
            description("match found");
}
else{
             description("no match");
}

I have a dashboard which contains Highcharts. My purpose is to test whether the linechart is correct or not. So the local image is the screenshot of the correct chart and I want to take a screenshot of the chart in dashboard and check if it matches the local image.

 but the result is always 'no match'. Besides charts, dashboard has one dropdown . The weird thing is Sikuli is able to find the match between a dropdown image and screenshot, but not between charts and screenshot.

Is sikuli incompatible with Highcharts? What's the difference between dropdown image and charts image? Why sikuli is able to match dropdown, but not the charts?

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
TestMechanic (ndinev) said :
#1

Sikuli does not know about underlying technology of what you are testing. It just compare images.

Just tried with https://www.highcharts.com/demo and Sikuli IDE - take an image and then verify it on screen - it works fine.

Revision history for this message
jessica xu (jessicafei026x) said :
#2

        WebDriver driver = new FirefoxDriver();
        driver.get("https://www.highcharts.com/demo/line-basic");
        Screen screen = new Screen();
        Pattern basic = new Pattern("/Users/jessicafei/Desktop/basic.PNG");
        Finder finder = new Finder(screen.capture());
        finder.findAll(basic);
        description(finder.hasNext()? "match found" : "no match");

Revision history for this message
jessica xu (jessicafei026x) said :
#3

basic.png is a image of one line in the chart. I still get "no match " as result.

Revision history for this message
TestMechanic (ndinev) said :
#4

Here is what you can do to see where is the issue:
-- make your script to save screen.capture
-- open sikuli ide and make var: base=somepath/base.png
-- now open your browser and navigate to charts
-- open screen capture image as well - to be visible on the screen
-- now using sikuli and clicking on base image you should be able to find it in both browser and screen capture

Can you help with this problem?

Provide an answer of your own, or ask jessica xu for more information if necessary.

To post a message you must log in.