Understanding PhantomJS

Since its release, PhantomJS has become a staple in the workflow of many JavaScript engineers. In the article titled “Headless WebKit and PhantomJS”, Colin Ihrig has introduced the concept of “Headless WebKit” and spent a few words on PhantomJS. With over 11,000 stars on GitHub, PhantomJS has become the go-to tool for developers, especially when dealing with testing their code. However, there are still many developers who have to refrain from implementing this tool in their projects due to lack of knowledge of what it really is.

To help fill this gap, in this article I’ll explain the core concepts of PhantomJS, and try to demystify some of the complexities that often seem to confuse developers. Once read this article, you will have a deep understanding of what PhantomJS is and why it is considered such a powerful tool.

“A Headless What?”

On PhantomJS’ website, the technology is explained as follows:

PhantomJS is a headless WebKit scriptable with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.

Clearly, of you who are new to PhantomJS will probably find some difficulties in seeing a number of foreign terms. This description might overwhelm aspiring developers, and make those new to the technologies believe that it is only for very expert developers. However, I can assure you that these concepts are quite simple to understand. PhantomJS is a web browser that exists only in script. There is no GUI, but rather a headless browser that can automate different processes with JavaScript.

Continue reading %Understanding PhantomJS%


Source: Sitepoint