Jump to content

PhantomJS

From Wikipedia, the free encyclopedia
(Redirected from Phantomjs)
PhantomJS
Original author(s)Ariya Hidayat
Developer(s)Ariya Hidayat
Initial releaseJanuary 17, 2011; 13 years ago (2011-01-17)
Final release
2.1.1[1] / January 24, 2016; 8 years ago (2016-01-24)
Repository
Written inC++, JavaScript, C
TypeHeadless browser
LicenseBSD[2]
Websitephantomjs.org Edit this on Wikidata

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 open-source software released under the BSD License.[2]

History

[edit]

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

The first commit to the public project was in 2011.[4]

The logo 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.[5]

Usage

[edit]

The PhantomJS JavaScript API can be used to open web pages, take screenshots, execute user actions, and run injected JavaScript in the page context. For example, the following code will open Wikipedia and, upon loading, will save a screenshot to a file and exit.

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

Ecosystem

[edit]

PhantomJS became valuable enough that similar projects adopted the API as a standard way of interacting with headless browsers. SlimerJS provided a PhantomJS-like API, but on top of Mozilla's Gecko browser engine rather than WebKit.[6] Similarly, trifleJS targeted the MSHTML engine of Internet Explorer.[7]

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 2017.[8]

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

Users

[edit]

Several notable companies have used PhantomJS.

See also

[edit]

References

[edit]
  1. ^ "Releases · ariya/phantomjs". GitHub. Retrieved 21 April 2017.
  2. ^ a b "phantomjs/LICENSE.BSD at master · ariya/phantomjs". GitHub.
  3. ^ "don't code today what you can't debug tomorrow". ariya.blogspot.com. 23 January 2011. Retrieved 20 July 2015.
  4. ^ "ariya/phantomjs". GitHub. Retrieved 20 July 2015.
  5. ^ "Archiving the project: suspending the development". ariya/phantomjs. Github. 2018-03-03.
  6. ^ Laurent Jouanneau. "FaQ - SlimerJS". slimerjs.org. Retrieved 20 July 2015.
  7. ^ "trifleJS". Retrieved 20 July 2015.
  8. ^ "CasperJS on GitHub". GitHub. Retrieved 2021-04-11.
  9. ^ Marcel Duran. "YSlow - Official Open Source Project Website". yslow.org. Retrieved 20 July 2015.
  10. ^ "Leo Lanese on Twitter". Twitter. Retrieved 20 July 2015.
  11. ^ phegaro (11 October 2011). "LinkedIn Mobile: How do we do it?". SlideShare. Retrieved 20 July 2015.
  12. ^ Michael Mimoso (26 August 2014). "Netflix Open Source Security Tools Solve Range of Challenges". threatpost.com. Retrieved 20 July 2015.
  13. ^ "one year of wandering headlessly". ofilabs.com. Archived from the original on 22 July 2015. Retrieved 20 July 2015.
[edit]