PhantomJS

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
PhantomJS
Original authorAriya Hidayat
Initial releaseDecember 26, 2010; 15 years ago (2010-12-26)
Final release
2.1.1[1] / January 24, 2016; 10 years ago (2016-01-24)
Repository
  • {{URL|example.com|optional display text}}Lua error in Module:EditAtWikidata at line 29: attempt to index field 'wikibase' (a nil value).
Written inC++, JavaScript, C
Engine
    Lua error in Module:EditAtWikidata at line 29: attempt to index field 'wikibase' (a nil value).
    TypeHeadless browser
    LicenseBSD
    Websitephantomjs.org

    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]

    Lua error in mw.title.lua at line 392: bad argument #2 to 'title.new' (unrecognized namespace name 'Portal').

    References

    [edit | edit source]
    1. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    2. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    3. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    4. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    5. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    6. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    7. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    8. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    [edit | edit source]