Complete re-write.

More robust. Now using Selenium. Ability to use PhantomJS for headless
execution.