GhostDriver has been released which means it is now easy to run reliable headless WebDriver tests on Mac OSX.
Steps to get working on OSX
- First make sure you have homebrew installed
- Run
brew update
then
brew install phantomjs
which should install PhantomJS 1.8.1 or newer
- Run irb and start using GhostDriver!
require 'watir-webdriver'
b = Watir::Browser.new :phantomjs
b.goto "www.google.com"
b.url #"http://www.google.com.au/"
b.title #"Google"
I’ve tested it on a large test suite (123 scenarios) and it behaves the same as other browsers with full JavaScript support. It took 8m13s in total: surprisingly it is slightly slower than ChromeDriver (7m30s) in my testing, but a little faster than the Firefox Driver (9m33s).
Well done to all involved in this project. It’s great to see a reliable, realistic headless browser with full JavaScript support for WebDriver finally released.
And yes, in case you’re wondering, it does screenshots!