How to compare image from a webelement with expected image | Selenium Forum
M
Posted on 27/08/2016
Hi, I was asked one question in an interview 'How to extract an image from some WebElement and compare it with an image available in a folder on my PC.'
Can someone tell me the answer with appropriate code..

M
Replied on 29/08/2016

download the image using this

http://www.software-testing-tutorials-automation.com/2015/01/download-and-save-image-using-selenium.html

this is the much easier way to extract the image
http://stackoverflow.com/questions/6813704/how-to-download-an-image-using-selenium-any-version

compare images using these resources

http://stackoverflow.com/questions/8567905/how-to-compare-images-for-similarity-using-java
http://stackoverflow.com/questions/21179019/how-to-compare-set-of-images-in-java-using-pixel-based-image-comparision-metric
https://rosettacode.org/wiki/Percentage_difference_between_images#Java