Introduction
PhantomJS is the headless WebKit – a fully-fledged WebKit-based browser with absolutely no graphical user interface. Instead of a GUI, PhantomJS features a scripting API that allows us to do just about anything that we would do with a normal browser. Since its introduction in 2010, PhantomJS has grown to be an essential tool in the web development stack. It is ideal for fast unit test watches, end-to-end tests in continuous integration, screen captures, screen scraping, performance data collection, and more.
The recipes in this chapter focus on PhantomJS fundamentals. We will discuss how to install PhantomJS, how to work with its Read-Evaluate-Print Loop (REPL), how to employ its command-line options, and how to launch PhantomJS in a debug harness.