Display browser logs when specs fail

Added selenium's dump of the browser console, which can be useful for identifying some JS errors.

This may be better to display as an optional command line argument.

Also, refactored some of the code.