18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

how to compare output of two html pages?

divkrishnadivkrishna Members
edited January 2014 in Sahi Pro
Hi ,

Can you please tell me how to compare output of two html pages. i dont want to use imagemagick.

Thanks,
Divya

Answers

  • Hi divkrishna...

    Ah I see you are Krishna and Divya. Guess that makes sense..

    Why would you compare 2 html files? Sahi is build around abstracting the html source to DOM elements and compare these. Want do you want to achieve by comparing the source code?

    Regards
    Wormi
  • Hi,

    My requirement is i have to compare two HTML file and the differences i have to log and assert through SAHI.
    so in my project i have there a lot of images with text in one page .and in that way there are several pages so i have to compare all pages with standard pages that it should look same.
    so for this reason i need to know some tool to compare it because manually its going to take long time. and once comparison done i can use_read file and asser through Sahi.

    Thanks,
    Divya
  • Do you need to know IF there is a difference or WHERE there is a difference?
  • No. I don't need to know that.
    FYI, I was able to compare two images using sikuli java API Screen class and using find method in it. (http://doc.sikuli.org/javadoc/org/sikuli/script/Screen.html)

    _call(window.focus());
    var $screenObj= new Packages.org.sikuli.script.Screen();
    _wait(3000);
    var $matchObj = $screenObj.find(new Packages.org.sikuli.script.Pattern("C:/Temp/sahi/benchmark.png"));
    var $screenScore = parseFloat($matchObj.getScore());

    if($screenScore)
    {
    _log($screenScore.toString());

    }
    else
    {
    _log("failure");
    }


Sign In or Register to comment.