PhantomJS

PhantomJS is a discontinued headless browser used for automating web page interaction.

Uses your system voice; voice and rate in settings.

Snapshot

≈ 5 min read

Names in other languages

No names in other languages are held for this entry yet.

Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.

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.

History

edit edit source

PhantomJS was released January 23, 2011 by Ariya Hidayat after several years in development.

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.[2]

Usage

edit edit source

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.

var page = require('webpage').create(); var url = 'http://en.wikipedia.org/'; page.open(url, function (status) { page.render('wikipedia.org.png'); phantom.exit(); });

Ecosystem

edit edit source

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.[3]

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.[4]

Yahoo! developed a version of YSlow that leverages PhantomJS to gather performance metrics for websites.[5]

Users

edit edit source

Several notable companies have used PhantomJS.

See also

edit edit source

References

edit edit source
  1. ^ "Tags · ariya/phantomjs". GitHub. 3 March 2018. Archived from the original on 1 April 2025. Retrieved 28 November 2025. Wikipedia revision 1334539779, retrieved 2026-11-18
  2. ^ "Archiving the project: suspending the development". ariya/phantomjs. GitHub. 2018-03-03. Retrieved 28 November 2025. Wikipedia revision 1334539779, retrieved 2026-11-18
  3. ^ Jouanneau, Laurent. "FaQ - SlimerJS". SlimerJS. Retrieved 28 November 2025.{{cite web}}: CS1 maint: url-status (link) Wikipedia revision 1334539779, retrieved 2026-11-18
  4. ^ "CasperJS on GitHub". GitHub. Retrieved 28 November 2025. Wikipedia revision 1334539779, retrieved 2026-11-18
  5. ^ Duran, Marcel. "YSlow for PhantomJS". YSlow. Retrieved 28 November 2025. Wikipedia revision 1334539779, retrieved 2026-11-18
  6. ^ Prasad, Kiran "phegaro" (11 October 2011). "LinkedIn Mobile: How do we do it?". SlideShare. Retrieved 28 November 2025. Wikipedia revision 1334539779, retrieved 2026-11-18
  7. ^ Mimoso, Michael (26 August 2014). "Netflix Open Source Security Tools Solve Range of Challenges". ThreadPost. Retrieved 28 November 2025.{{cite web}}: CS1 maint: url-status (link) Wikipedia revision 1334539779, retrieved 2026-11-18
  8. ^ Hidayat, Ariya (23 January 2012). "one year of wandering headlessly". ariya.io. Archived from the original on 25 December 2024. Retrieved 28 November 2025. Wikipedia revision 1334539779, retrieved 2026-11-18
edit edit source Web browsers Gecko-based Goanna-based WebKit-based Multi-engine Other JavaScriptCode analysis Subsets, supersets Transpilers Concepts Debuggers Documentation generators Engines Frameworks Related technologies Package managers Module bundlers Server-side Unit testing frameworks (list) People

Text derived from https://en.wikipedia.org/w/index.php?oldid=1334539779 under CC BY-SA 4.0; modifications have been made.