

#IMAGEMAGICK SELENIUM CODE#
The code to run this test case looks like this: public static void TestGoogleHomepage() The picture tells us that there are no big differences between the Google homepage in Chrome (my known-to-be-good browser) and Firefox. The tester only needs to manually review the final image file, which will look something like this:.The tool ImageMagick can be used to compare the image taken in the known-to-be-good browser with all other images and create a visual representation of the differences found.Now use Selenium to take screenshots in all other supported browsers.We now have a screenshot of the page as it should be. After development is finished we can use Selenium to automatically take a screenshot in this known-to-be-good browser.This will be our so-called known-to-be-good browser. During development use a specific browser for testing.Cross-browser testing a static page simply means that the layout works correctly across all targeted browsers. The easiest possible test case would be the testing of a simple static page that does not have any user interaction. I have written the code examples in C# but any other Selenium-supported language (Java, PHP, JavaScript …) will work the same.

Otherwise, no special knowledge is necessary.
#IMAGEMAGICK SELENIUM HOW TO#
To run the tests described in the post you will need a Selenium Grid ( How to install one) and the cross-platform image tool ImageMagick. The discussed method below supports all major browsers. Moreover you should think about which browsers you want to test in an automated fashion. you have a clear plan when and how to execute the tests.you have a suitable test execution environment.you need to do regression tests multiple times.you need to support a high number of browsers.When to automate?Ĭreating automation scripts and processes takes quite a bit of time and resources so you should make sure that it is really necessary in your case. Today I would like to show you a great way to automate and speed up most of your cross browser testing.īut before we jump right into automation lets see when it even makes sense to use automation in your cross browser testing.
