| PhantomJS | |
|---|---|
| |
| Original author | Ariya Hidayat |
| Initial release | December 26, 2010 |
| Final release | 2.1.1 [1] / January 24, 2016 |
| Repository | |
| Written in | C++, JavaScript, C |
| Type | Headless browser |
| License | BSD |
| Website | phantomjs |
PhantomJS is a discontinued headless browser used for automating web page interaction. PhantomJS provides a JavaScript API enabling automated navigation, screenshots, user behavior and assertions making it a common tool used to run browser-based unit tests in a headless system like a continuous integration environment. PhantomJS is based on WebKit making it a similar browsing environment to Safari and Google Chrome (before Chrome's fork of WebKit evolved into Blink). It is an open-source software released under the BSD License.
PhantomJS was released on December 26, 2010 by Ariya Hidayat. [2]
The logo of the project commonly used to pictorially refer to PhantomJS is a fluorescent blue ghost atop a black background. This refers to the lack of graphical user interface, or main body of the browser, making PhantomJS users seem like ghosts.
In March 2018, the development of PhantomJS was suspended due to lack of active contributions. [3]
The PhantomJS JavaScript API can be used to open web pages, take screenshots, execute user actions, and run injected JavaScript code in the page context. For example, the following code will open Wikipedia and, upon loading, will save a screenshot to a file and exit.
varpage=require('webpage').create();varurl='http://en.wikipedia.org/';page.open(url,function(status){page.render('wikipedia.org.png');phantom.exit();});PhantomJS became valuable enough that similar projects adopted the API as a standard way of interacting with headless browsers. For example, SlimerJS provided a PhantomJS-like API, but on top of Mozilla's Gecko browser engine rather than WebKit. [4]
Shortly after the release of PhantomJS, Nicolas Perriault wrote CasperJS, a suite of libraries on top of PhantomJS that extend its capabilities as a client for automated web page testing, allowing users to create BDD tests leveraging PhantomJS. The final release of CasperJS was in November 2017. [5]
Yahoo! developed a version of YSlow that leverages PhantomJS to gather performance metrics for websites. [6]
Several notable companies have used PhantomJS.
{{cite web}}: CS1 maint: url-status (link){{cite web}}: CS1 maint: url-status (link)