Forum Discussion
Colin_McCrae
11 years agoCommunity Hero
Not sure why your comparisons are failing. As mentioned above, image compares are notoriously fickle.
But one thing I will add, is where you are capturing a screenshot of a webpage .... you are not controlling the size of the browser. If someone manually re-sizes the browser, it may well open at that size the next time your test starts a browser.
So I would suggest you add some extra code to control the browser size. It can be a problem causing visibility failures and accessing controls. But for image compares, in my book, controlling the browser size if pretty much essential if you want accurate results. All my scripted tests open browsers of very specific sizes so I always know what I'm dealing with during a run.
(Note - the way you control the size of IE vs Chrome in code - VBScript in my case - is different. So you'll need to know the browser in use and apply the sizing code to each accordingly. No idea about FireFox, I don't use that at work.)
But one thing I will add, is where you are capturing a screenshot of a webpage .... you are not controlling the size of the browser. If someone manually re-sizes the browser, it may well open at that size the next time your test starts a browser.
So I would suggest you add some extra code to control the browser size. It can be a problem causing visibility failures and accessing controls. But for image compares, in my book, controlling the browser size if pretty much essential if you want accurate results. All my scripted tests open browsers of very specific sizes so I always know what I'm dealing with during a run.
(Note - the way you control the size of IE vs Chrome in code - VBScript in my case - is different. So you'll need to know the browser in use and apply the sizing code to each accordingly. No idea about FireFox, I don't use that at work.)
ajitkumar163
11 years agoOccasional Contributor
Hi Colin,
Thanks for your useful comments,In my application there is one option to Control the size of the Image to search for.After increasing the size of the image this test is working fine for me.I guess the test was getting failed due the very small size of that Image to search for.I used
"Regions.FindRegion(PictureToSearchFor, PictureToSearchIn, Left, Top, Transparent, Mouse, PixelTolerance)" to find the required Image.
Thanks,
Ajit