Web Element Image Comparison in Selenium Using aShot



Web  Element Image Comparison in Selenium Using aShot


In this blog, we are going to learn, how we can compare images of two web elements using Third-party utility “aShot”.

I would highly recommend referring to this blog before moving further.

As we discussed in another blog, on how to capture the screenshot of particular web element we will be using the same concept and screenshot to compare two images.


Below is the code snippet where I have tried to compare google logo (expected image) which I have taken in the attached blog with the google logo while running the current program (actual image).


Please Note the comparison of the image would be done pixel by pixel even for a small difference in the shape or size of the image will fail the test.

After executing the above code result will looks something like:





SHARE THIS

Author:

My Name is Ankur Jain and I am currently working as Automation Test Architect.I am ISTQB Certified Test Manager,Certified UI Path RPA Developer as well as Certified Scrum Master with total 12 years of working experience with lot of big banking clients around the globe.I love to Design Automation Testing Frameworks with Selenium,Appium,Protractor,Cucumber,Rest-Assured, Katalon Studio and currently exploring lot in Dev-OPS as well. I am currently staying in Mumbai, Maharashtra. Please Connect with me through Contact Us page of this website.

Previous Post
Next Post