Forum Discussion

_Oliver_'s avatar
_Oliver_
Contributor
23 days ago

Compare two web pages (TestComplete/VisualTest)

Hi all,

I use the TestComplete Advanced Bundle, which includes VisualTest.
I'd like to (from TestComplete) be able to take screenshots of two different web pages and visually compare these screnshots. I am very new to both TestComplete and VisualTest, and I'm having a bit of trouble to figure out how to achieve that. I assume it must be quite simple... when one knows how to do it :)
Any help would be welcome.
Thanks!

  • I'm replying to myself (can be useful for others).
    I succeeded with taking a screen capture of the whole page with

    picture = page.PagePicture(); 

    in a js script, and then used the build-in keywordTests operation "Compare Pictures"

  • catalin_ochisor's avatar
    catalin_ochisor
    Occasional Contributor

    Hi _Oliver_,

    How complex is the web page you are trying to test? - are there elements you expect will change in each run? - for example dates, time, names, titles, etc. Are there any custom controls - like Infragistics UI controls? charts, graphics? Do you expect frequent changes in the page? Is this for regression test mainly or part of an in-sprint automation test suite? The answers to these and some other questions will help in choosing the right solution.

    You can choose the solution mentioned in replies to your message and have a long list of assertions comparing regions, object properties, excluding elements which change from run to run and so on.

    However, a better option IMO is to use VisualTest which was designed to exactly this goal - and leverage its features. Start by reading the documentation at:

    https://support.smartbear.com/testcomplete/docs/working-with/integration/visual-testing.html

    Have a look at it and post your opinion here. If you are allowed to post a copy of your web page here that would be helpful.