As part of automation, I want to compare images by taking screenshot and the baseline image. Will be executing the same on different OS(linux, win). On executing in different OS, the screen resolution changes and image comparison fails. Currently I am doing it with Selenium+java. Can anybody suggest me any way or a different tool to achieve it?
Asked
Active
Viewed 271 times
2 Answers
0
So make baselines for each environment you're testing on and have the test compare with the correct one for that platform (or just with all of them and flag as passed if any of them matches).
I'm not so sure this entire "compare screenshots" is a good way to test things (you just hit one snag, another one can be that different browsers (and even versions of the same browser) render things slightly differently.

jwenting
- 5,505
- 2
- 25
- 30
0
The key thing here is the resolution, you must ensure that resolution is the same for base images and those you capture during test.
- Set size of the browser window to fixed size, eg. (1920x1080),
- Make all screenshots in this resolution,
- During the test: before each image-comparison check if the window size is (1920x1080) if not I change it temporarily,
- Take screenshot,
- Compare image with original one
- Do window maximize
Other solution is to capture screenshots of single WebElement rather than whole page, because WebElements often are resolution independent.

Leszek_PL
- 31
- 4