Today I came across a new project called Huxley that is described as a test-like system for catching visual regressions in Web applications. Though I’ve seen many frameworks that either focus on the micro level unit testing or the macro level functional and integration tests, this is the first time I’ve seen a testing framework that focuses on catching visual regressions on the web. It’s written in python and under the hood, is using the Selenium WebDriver to handle browser automation and take screenshots.
To be honest, I didn’t even realize that Selenium WebDriver could take screenshots. That said, I realized I had more to learn about it. After looking through the api docs, I found that taking a screenshot, is very easy.
Check it out.
If you do not have the Selenium WebDriver gem installed, get that as well.
Now for the code to take the screenshot
1 2 3 4 5 6 7 8 9
Couldn’t be any easier. I love finding new bits of code that are this easy to use. Needless to say, I’m going to be delving a bit deeper into this and see if I can come up with any new tools.