Forum Discussion

simonaferrara's avatar
Frequent Contributor
3 years ago

Image comparison for scalable elements

Hi all,


some elements within a web pages are scalable, so their size is decreased or enlarged basing on the browser window size.

In my test, I would like to check this scalable elements with an image comparison, basing on benchmark images that I've saved within Regions. But surely the comparison will fail if the browser size is different from the one where I've captured the image.


Is there a way to prevent to be bound to fix the browser window size basing on its size when the image has been captured?

In other words, I would like to do the image comparison independently from the zoom that have got the image. Is it possible?


Thank you!


3 Replies

  • Marsha_R's avatar
    Champion Level 3

    The short answer is no.  🙂


    TestComplete only knows what you would know if you were looking at the two images yourself.  If they look different to you, then they will look different to TestComplete.


    The way around this is to always make sure that the browser is maximized.  Do that when you are taking your base images to store and do that when you are in the test and want to perform the compare.

    • simonaferrara's avatar
      Frequent Contributor

      Could it be considered an improvement for future versions, to have the possibility to do an image comparison that adapts to the zoom of the browser? 

      That is... for example.. I take the benchmark with 100% of zoom, then I would like to be able to compare it also if the browser is resized.


      I've understand the way around; the issue still become if the machines resolution is different, because if I maximize the browser window on a release machine (a different machine comparing to the one used for the test automation development), the test will fail if it has got a different resolution.


      • jr348's avatar

        I did it a few years ago with checking and clicking things on maps in .NET/desktop.


        I set the size of the screen to known zoom levels before doing a comparisons.  Also having reference markers of known size and reducing the zoom in steps until found using a find-image function. Once found panning the image to make it central then using that as reference for other elements being tested, eg map icons etc.  It was extremely slow!