In this article, I will present you how to do visual test automation with ImageMagick, Selenium Webdriver, and AShot. This tool and framework combination is fully open-source and when you successfully complete the settings, you can start to do visual testing with them without any cost. 🙂

First, I want to describe the tools:

Selenium Webdriver: We will use webdriver to navigate, interrogate and manipulate the websites.

ImageMagick: ImageMagick is our image processing and comparison tool.


Pure JAVA Interface (im4java):

AShot: AShot is our Webdriver Screenshot utility tool. We will capture the screenshots with AShot. It is developed by Yandex and its open source.


Step by Step Installations

 Step-1: Selenium Webdriver

 If you do not know how to start using Selenium Webdriver, please first read this article.

 Step-2: Visual C++ Redistributable Packages for Visual Studio 2013

 Go to this link: and install it.





Step-3: ImageMagick

 Go to and install Windows Binary Release, during installation select all options and set its installation directory location to the system path.

It is important to select all options.






UPDATE: For MAC OS users, they need to install ImageMagick by using brew command.

By installing ImageMagick, you will be able to run “compare” method of ImageMagick by terminal.

How to Setup Project for ImageMagick and Selenium

Test Scenario:

– Open

– Add top banner cookie not to see top banner.

– Close Popup if exists

– Close Banner

– Unhide text area (“21.923 İŞ İLANI” part) of Uzman Photo

– Hover on the “UZMAN” section on main page.


– Wait for 2 seconds for completion of image (CSS) animation.


– Take a screenshot of the animated photo of this element.

– At first run, save it to the ScreenShots>$Test_Name folder as uzmanBaseline.png and uzmanActual.png.

– At second run, update uzmanActual.png, compare it with uzmanBaseline.png, and put the difference as uzmanDiff.png

– Put all differences on “Differences” folder.

– Verify that if they are similar test passed. If not test failed.

Project Setup:

Open IntelliJ and click File -> New -> Project -> Maven

Then, fill GroupId and ArtifactId as KariyerVisualTest


Click Next and then give a name to the project as KariyerVisualTest and click Next.


After that we should modify our pom.xml

Always check libraries latest versions from

For Selenium:

For AShot:

For IM4Java:

For TestNG:

Test Code

In below code I tried to write detailed comments. If you have trouble something please feel free to add comment. I will try to reply your questions as soon as possible.

BaseTest Class

JSWaiter (For JS and JQuery Synchronization)

KariyerVisualTest (Test Class)