Scriptable Headless Browser

Overview

PhantomJS - Scriptable Headless WebKit

PhantomJS (phantomjs.org) is a headless WebKit scriptable with JavaScript. The latest stable release is version 2.1.

Important: PhantomJS development is suspended until further notice (see #15344 for more details).

Use Cases

  • Headless web testing. Lightning-fast testing without the browser is now possible!
  • Page automation. Access and manipulate web pages with the standard DOM API, or with usual libraries like jQuery.
  • Screen capture. Programmatically capture web contents, including CSS, SVG and Canvas. Build server-side web graphics apps, from a screenshot service to a vector chart rasterizer.
  • Network monitoring. Automate performance analysis, track page loading and export as standard HAR format.

Features

  • Multiplatform, available on major operating systems: Windows, Mac OS X, Linux, and other Unices.
  • Fast and native implementation of web standards: DOM, CSS, JavaScript, Canvas, and SVG. No emulation!
  • Pure headless (no X11) on Linux, ideal for continuous integration systems. Also runs on Amazon EC2, Heroku, and Iron.io.
  • Easy to install: Download, unpack, and start having fun in just 5 minutes.

Questions?

PhantomJS is free software/open source, and is distributed under the BSD license. It contains third-party code, see the included third-party.txt file for the license information on third-party code.

PhantomJS is created and maintained by @ariyahidayat, with the help of many contributors.

Comments
  • PhantomJS 2: PDF rendering too large, page.zoomFactor doesn't work

    PhantomJS 2: PDF rendering too large, page.zoomFactor doesn't work

    I compiled PhantomJS 2 HEAD on OS X 10.9.5 (MacBook Pro Retina) via brew install phantomjs --HEAD.

    When rendering a PDF via rasterize.js, the page contents are rendered much larger than with PhantomJS 1.9, and using the zoom argument doesn't change anything at all.

    Experimenting with paperSize, the page contents that do usually fit exactly into 210mm (A4) do now need 303mm, so there's a 144% increase in size.

    Bug PJS core 
    opened by thomasbachem 201
  • File download

    File download

    [email protected] commented:

    It would be good to accept (and save) 'Content-Disposition: attachment; filename=' content.

    Disclaimer: This issue was migrated on 2013-03-15 from the project's former issue tracker on Google Code, Issue #52. :star2:   40 people had starred this issue at the time of migration.

    PJS core 
    opened by ariya 159
  • CoreText Issue on OS X Mavericks. For best performance, only use PostScript names when calling CTFontCreateWithName()

    CoreText Issue on OS X Mavericks. For best performance, only use PostScript names when calling CTFontCreateWithName()

    When I run phantoms 1.9.1 (downloaded) on the new OS X Mavericks, I got this:

    2013-06-19 23:46:05.765 phantomjs[6149:507] CoreText performance note: Client called CTFontCreateWithName() using name "Times New Roman" and got font with PostScript name "TimesNewRomanPSMT". For best performance, only use PostScript names when calling this API. 2013-06-19 23:46:05.767 phantomjs[6149:507] CoreText performance note: Set a breakpoint on CTFontLogSuboptimalRequest to debug.

    I think change the "Times New Roman" to "TimesNewRomanPSMT" may fix the issue.

    opened by wisesimpson 142
  • PhantomJS stops working while loading page

    PhantomJS stops working while loading page

    Our Behat-Tests use PhantomJS as browser via selenium2/webdriver. The execution stops occasionally during page loading.

    We have no idea how to solve this problem, as it occurs not always at the same step/scenario.

    Any ideas what the problem is or how to solve it?

    Config:

    • started with option --webdriver=18643
    • tests were run with behat
    • process still responding on http://localhost:18643/wd/hub

    PhantomJS Debug-Output

        2013-07-26T11:11:33 [DEBUG] WebPage - updateLoadingProgress: 14
    2013-07-26T11:11:33 [DEBUG] WebPage - updateLoadingProgress: 26
    2013-07-26T11:11:33 [DEBUG] WebPage - setupFrame ""
    2013-07-26T11:11:33 [DEBUG] WebPage - updateLoadingProgress: 52
    2013-07-26T11:11:33 [DEBUG] WebPage - updateLoadingProgress: 55
    2013-07-26T11:11:33 [DEBUG] WebPage - updateLoadingProgress: 82
    2013-07-26T11:11:54 [DEBUG] WebPage - updateLoadingProgress: 84
    2013-07-26T11:12:04 [DEBUG] WebPage - updateLoadingProgress: 84
    [INFO  - 2013-07-26T09:15:21.610Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW
    [INFO  - 2013-07-26T09:20:21.610Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW
    [INFO  - 2013-07-26T09:25:21.609Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW
    [INFO  - 2013-07-26T09:30:21.610Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW
    [INFO  - 2013-07-26T09:35:21.610Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW
    [INFO  - 2013-07-26T09:40:21.610Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW
    [INFO  - 2013-07-26T09:45:21.610Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW
    [INFO  - 2013-07-26T09:50:21.609Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW
    [INFO  - 2013-07-26T09:55:21.610Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW
    [INFO  - 2013-07-26T10:00:21.610Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW
    [INFO  - 2013-07-26T10:05:21.610Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW
    

    regards florian

    Need reproduction Need more information stale 
    opened by floriansemm 127
  • Operation canceled on some pages

    Operation canceled on some pages

    Hello,

    I'm experiencing some issues with phantomJS when trying to render some Urls. It works well for 99% of the requested urls but some are not working and i'm getting the "Operation canceled" error.

    To reproduce the error you can use this simple script :

    var webPage = require('webpage');
    var page = webPage.create();
    
    page.viewportSize = { width: 1920, height: 1080 };
    page.open("http://www.thalesgroup.com", function start(status) {
      page.render('screenshot.jpeg', {format: 'jpeg', quality: '100'});
      phantom.exit();
    });
    

    It will produce the following result.

    phantomjs-1.9.8-linux-x86_64/bin/phantomjs --debug=true --ignore-ssl-errors=yes --web-security=no --ssl-protocol=any simpleRender.js 
    2014-11-17T15:18:32 [DEBUG] CookieJar - Created but will not store cookies (use option '--cookies-file=<filename>' to enable persisten cookie storage) 
    2014-11-17T15:18:32 [DEBUG] Phantom - execute: Configuration 
    2014-11-17T15:18:32 [DEBUG]      0 objectName : "" 
    2014-11-17T15:18:32 [DEBUG]      1 cookiesFile : "" 
    2014-11-17T15:18:32 [DEBUG]      2 diskCacheEnabled : "false" 
    2014-11-17T15:18:32 [DEBUG]      3 maxDiskCacheSize : "-1" 
    2014-11-17T15:18:32 [DEBUG]      4 ignoreSslErrors : "true" 
    2014-11-17T15:18:32 [DEBUG]      5 localToRemoteUrlAccessEnabled : "false" 
    2014-11-17T15:18:32 [DEBUG]      6 outputEncoding : "UTF-8" 
    2014-11-17T15:18:32 [DEBUG]      7 proxyType : "http" 
    2014-11-17T15:18:32 [DEBUG]      8 proxy : ":1080" 
    2014-11-17T15:18:32 [DEBUG]      9 proxyAuth : ":" 
    2014-11-17T15:18:32 [DEBUG]      10 scriptEncoding : "UTF-8" 
    2014-11-17T15:18:32 [DEBUG]      11 webSecurityEnabled : "false" 
    2014-11-17T15:18:32 [DEBUG]      12 offlineStoragePath : "" 
    2014-11-17T15:18:32 [DEBUG]      13 offlineStorageDefaultQuota : "-1" 
    2014-11-17T15:18:32 [DEBUG]      14 printDebugMessages : "true" 
    2014-11-17T15:18:32 [DEBUG]      15 javascriptCanOpenWindows : "true" 
    2014-11-17T15:18:32 [DEBUG]      16 javascriptCanCloseWindows : "true" 
    2014-11-17T15:18:32 [DEBUG]      17 sslProtocol : "any" 
    2014-11-17T15:18:32 [DEBUG]      18 sslCertificatesPath : "" 
    2014-11-17T15:18:32 [DEBUG]      19 webdriver : ":" 
    2014-11-17T15:18:32 [DEBUG]      20 webdriverLogFile : "" 
    2014-11-17T15:18:32 [DEBUG]      21 webdriverLogLevel : "INFO" 
    2014-11-17T15:18:32 [DEBUG]      22 webdriverSeleniumGridHub : "" 
    2014-11-17T15:18:32 [DEBUG] Phantom - execute: Script & Arguments 
    2014-11-17T15:18:32 [DEBUG]      script: "simpleRender.js" 
    2014-11-17T15:18:32 [DEBUG] Phantom - execute: Starting normal mode 
    2014-11-17T15:18:32 [DEBUG] WebPage - setupFrame "" 
    2014-11-17T15:18:32 [DEBUG] FileSystem - _open: ":/modules/fs.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:32 [DEBUG] FileSystem - _open: ":/modules/system.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:32 [DEBUG] FileSystem - _open: ":/modules/_coffee-script.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:32 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/package.json" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:32 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/coffee-script.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:32 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/./lexer.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:32 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/././rewriter.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:32 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/././helpers.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:32 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/./parser.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:32 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/./helpers.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:32 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/./nodes.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:32 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/././scope.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:32 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/./././helpers.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:32 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/././lexer.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:32 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/./././rewriter.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:32 [DEBUG] FileSystem - _open: ":/modules/webpage.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:32 [DEBUG] WebPage - updateLoadingProgress: 10 
    2014-11-17T15:18:35 [DEBUG] WebPage - updateLoadingProgress: 16 
    2014-11-17T15:18:35 [DEBUG] WebPage - updateLoadingProgress: 19 
    2014-11-17T15:18:35 [DEBUG] WebPage - updateLoadingProgress: 21 
    2014-11-17T15:18:35 [DEBUG] WebPage - updateLoadingProgress: 27 
    2014-11-17T15:18:35 [DEBUG] WebPage - updateLoadingProgress: 31 
    2014-11-17T15:18:35 [DEBUG] WebPage - updateLoadingProgress: 37 
    2014-11-17T15:18:35 [DEBUG] WebPage - updateLoadingProgress: 40 
    2014-11-17T15:18:35 [DEBUG] WebPage - updateLoadingProgress: 42 
    2014-11-17T15:18:35 [DEBUG] WebPage - setupFrame "" 
    2014-11-17T15:18:35 [DEBUG] CookieJar - Saved "has_js=1; domain=www.thalesgroup.com; path=/" 
    2014-11-17T15:18:36 [DEBUG] WebPage - updateLoadingProgress: 45 
    2014-11-17T15:18:36 [DEBUG] CookieJar - Saved "has_js=1; domain=www.thalesgroup.com; path=/" 
    2014-11-17T15:18:36 [DEBUG] CookieJar - Saved "context_breakpoints=none; domain=www.thalesgroup.com; path=/" 
    2014-11-17T15:18:36 [DEBUG] WebPage - updateLoadingProgress: 100 
    2014-11-17T15:18:36 [DEBUG] Network - Resource request error: 5 ( "Operation canceled" ) URL: "https://secure.leadforensics.com/Track/Capture.aspx?trk_user=26055&trk_sw=1024&trk_sh=768&trk_ref=&trk_tit=Thales Group&trk_loc=https://www.thalesgroup.com/en&trk_agn=Netscape&trk_agv=Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34.lfcd32.lflngfr-FR&trk_dom=www.thalesgroup.com&trk_guid=1e390c06-f5a3-41e8-bc51-d4a46952b54e&trk_cookie=NA" 
    2014-11-17T15:18:36 [DEBUG] Network - Resource request error: 5 ( "Operation canceled" ) URL: "https://www.google-analytics.com/analytics.js" 
    2014-11-17T15:18:36 [DEBUG] Network - Resource request error: 5 ( "Operation canceled" ) URL: "https://www.thalesgroup.com/sites/default/files/js/js_3gTGsabd1RPSpnBDnrFkHoY_7DsRs04arZaXhxjiyHY.js" 
    2014-11-17T15:18:36 [DEBUG] WebPage - updateLoadingProgress: 10 
    2014-11-17T15:18:36 [DEBUG] WebPage - setupFrame "" 
    2014-11-17T15:18:36 [DEBUG] FileSystem - _open: ":/modules/fs.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:36 [DEBUG] FileSystem - _open: ":/modules/system.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:36 [DEBUG] FileSystem - _open: ":/modules/_coffee-script.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:36 [DEBUG] FileSystem - _open: ":/modules/webpage.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:36 [DEBUG] WebPage - updateLoadingProgress: 10 
    2014-11-17T15:18:36 [DEBUG] WebPage - setupFrame "" 
    2014-11-17T15:18:36 [DEBUG] FileSystem - _open: ":/modules/fs.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:36 [DEBUG] FileSystem - _open: ":/modules/system.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:36 [DEBUG] FileSystem - _open: ":/modules/_coffee-script.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:36 [DEBUG] FileSystem - _open: ":/modules/webpage.js" QMap(("mode", QVariant(QString, "r") ) )  
    2014-11-17T15:18:36 [DEBUG] WebPage - updateLoadingProgress: 100 
    2014-11-17T15:18:36 [DEBUG] WebPage - setupFrame "" 
    2014-11-17T15:18:36 [DEBUG] Network - Resource request error: 5 ( "Operation canceled" ) URL: "https://www.thalesgroup.com/en" 
    2014-11-17T15:18:36 [DEBUG] WebPage - updateLoadingProgress: 100 
    2014-11-17T15:18:36 [DEBUG] WebPage - updateLoadingProgress: 10 
    2014-11-17T15:18:36 [DEBUG] WebPage - setupFrame "" 
    2014-11-17T15:18:36 [DEBUG] WebPage - updateLoadingProgress: 100 
    2014-11-17T15:18:36 [DEBUG] WebPage - setupFrame "" 
    2014-11-17T15:18:36 [DEBUG] CookieJar - Purged (session) "context_breakpoints=none; domain=www.thalesgroup.com; path=/" 
    2014-11-17T15:18:36 [DEBUG] CookieJar - Purged (session) "has_js=1; domain=www.thalesgroup.com; path=/" 
    

    Thanks for your help. Guillaume.

    Bug Confirmed stale 
    opened by Guigoz 106
  • Implement support for CommonJS 'require(moduleId)' API

    Implement support for CommonJS 'require(moduleId)' API

    [email protected] commented:

    During testing that involve DOM Manipulation, it should be possible to simulate user clicks.

    Something like: <code> phantom.click(CSS SELECTOR) </code>

    Disclaimer: This issue was migrated on 2013-03-15 from the project's former issue tracker on Google Code, Issue #47. :star2:   22 people had starred this issue at the time of migration.

    opened by detro 106
  • Adding support for getting body of requests or responses

    Adding support for getting body of requests or responses

    [email protected] commented:

    Adding support for accessing body of requests (useful for http post requests) in the onResourceRequested call back.

    Which version of PhantomJS are you using? 1.2

    Disclaimer: This issue was migrated on 2013-03-15 from the project's former issue tracker on Google Code, Issue #158. :star2:   31 people had starred this issue at the time of migration.

    Confirmed PJS core Need testing 
    opened by ghost 103
  • Web Fonts do not render, use fallback fonts instead.

    Web Fonts do not render, use fallback fonts instead.

    [email protected] commented:

    Which version of PhantomJS are you using? Tip: run 'phantomjs --version'.

    1.5.1 (development)

    What steps will reproduce the problem?

    1. Using rasterize.js generate a png of https://developers.google.com/webfonts/
    2. You should see stylized text for some of the web fonts.

    What is the expected output? What do you see instead?

    --see actual/expected images. Web fonts use their fallbacks instead of the "real" fonts.

    Which operating system are you using?

    Windows 2008 R2

    Did you use binary PhantomJS or did you compile it from source?

    no, downloaded the (1.5.0 static package from the project website)

    Please provide any additional information below.

    Disclaimer: This issue was migrated on 2013-03-15 from the project's former issue tracker on Google Code, Issue #592. :star2:   30 people had starred this issue at the time of migration.

    opened by atheken 100
  • Suggestion: Include hyperlink action in PDF output for hyperlinks in webpage

    Suggestion: Include hyperlink action in PDF output for hyperlinks in webpage

    [email protected] commented:

    PhantomJS v1.2.0

    If you rasterie the URL http://www.nu.nl/buitenland/2590433/voedselhulp-wordt-in-mogadishu-gestolen-.html, it contains selectable text in PDF. Which is great!

    But this news page contains a lot of link when opened in a normal browser. The PDF output shows no similar hyperlinks on the available text.

    My suggestion: associate a hyperlink action where relevant.

    This allows the PDF to more resemble the actual website.

    Disclaimer: This issue was migrated on 2013-03-15 from the project's former issue tracker on Google Code, Issue #196. :star2:   8 people had starred this issue at the time of migration.

    Qt/Other 
    opened by ariya 100
  • Support Solaris (and also Joyent SmartOS)

    Support Solaris (and also Joyent SmartOS)

    [email protected] commented:

    Currently Solaris, and hence also Solaris-based SmartOS from Joyent, is not supported.

    Disclaimer: This issue was migrated on 2013-03-15 from the project's former issue tracker on Google Code, Issue #521. :star2:   5 people had starred this issue at the time of migration.

    opened by ariya 83
  • memory leak with WebPage class, multiple page loads

    memory leak with WebPage class, multiple page loads

    There is a memory leak when reusing a phantomjs instance, averaging about 1.4mb per page load in debian 7. (for example, loading 200 pages results in 280mb memory use). I have reprod this on Debian7 x64 and Windows8 x64

    I have included a phantomjs script that can be used to reproduce the memory leak. I am following what seems to be "best practice" by invoking page.close() after the load is done, but that does not resolve the issue.

    fyi, in addition to my repro script, i have tried various combinations of tests such as

    • close after page.onLoadFinished() has completed (not during)
    • reusing the same page object multiple times
    • not calling page.stop()

    none of those had any positive impact on the memory leak problem.

    here's my repro script, paste it into something like memoryleak.js and run from the command prompt. NSFW: The test domains are the top 100 domains by traffic, and that includes porn sites, so if you have some corporate IT network traffic monitoring going on, remove the naughty sites from the testUrls array.

    /// memoryleak.js
    function format(toFormat) {
        var args = [];
        for (var _i = 0; _i < (arguments.length - 1); _i++) {
            args[_i] = arguments[_i + 1];
        }
        return (toFormat).replace(/\{(\d+)\}/g, function (match, number) {
            return typeof args[number] !== "undefined" ? args[number].toString() : match;
        });
    }
    ;
    var system = require("system");
    phantom.onError = function (msg, trace) {
        try  {
            console.log("phantom encountered an error.  exiting... " + "msg=\"" + msg + "\"" + " trace=\"" + trace + "\"/>");
        }finally {
            phantom.exit(-1);
        }
    };
    /** NSFW: The test domains are the top 100 domains by traffic, and that includes porn sites, so if you have some corporate IT network traffic monitoring going on, remove the naughty sites from the testUrls array. */
    var testUrls = [
        "google.com", 
        "facebook.com", 
        "youtube.com", 
        "yahoo.com", 
        "amazon.com", 
        "bing.com", 
        "ebay.com", 
        "wikipedia.org", 
        "craigslist.org", 
        "linkedin.com", 
        "live.com", 
        "twitter.com", 
        "blogspot.com", 
        "aol.com", 
        "go.com", 
        "pinterest.com", 
        "msn.com", 
        "tumblr.com", 
        "cnn.com", 
        "ask.com", 
        "huffingtonpost.com", 
        "netflix.com", 
        "paypal.com", 
        "weather.com", 
        "conduit.com", 
        "espn.go.com", 
        "instagram.com", 
        "wordpress.com", 
        "bankofamerica.com", 
        "akamihd.net", 
        "imdb.com", 
        "chase.com", 
        "microsoft.com", 
        "about.com", 
        "avg.com", 
        "pornhub.com", 
        "comcast.net", 
        "foxnews.com", 
        "apple.com", 
        "walmart.com", 
        "xhamster.com", 
        "mywebsearch.com", 
        "wellsfargo.com", 
        "xvideos.com", 
        "yelp.com", 
        "imgur.com", 
        "nytimes.com", 
        "nbcnews.com", 
        "cnet.com", 
        "reddit.com", 
        "adobe.com", 
        "ehow.com", 
        "pandora.com", 
        "pch.com", 
        "hulu.com", 
        "zedo.com", 
        "etsy.com", 
        "flickr.com", 
        "outbrain.com", 
        "optmd.com", 
        "indeed.com", 
        "livejasmin.com", 
        "zillow.com", 
        "target.com", 
        "xnxx.com", 
        "homedepot.com", 
        "redtube.com", 
        "answers.com", 
        "thepiratebay.sx", 
        "att.com", 
        "shopathome.com", 
        "wikia.com", 
        "dailymail.co.uk", 
        "usps.com", 
        "babylon.com", 
        "ups.com", 
        "bestbuy.com", 
        "youporn.com", 
        "reference.com", 
        "godaddy.com", 
        "groupon.com", 
        "deviantart.com", 
        "usatoday.com", 
        "pof.com", 
        "capitalone.com", 
        "bbc.co.uk", 
        "washingtonpost.com", 
        "match.com", 
        "drudgereport.com", 
        "mlb.com", 
        "tripadvisor.com", 
        "pogo.com", 
        "verizonwireless.com", 
        "blogger.com", 
        "buzzfeed.com", 
        "doublepimp.com", 
        "inksr.com", 
        "delta-search.com", 
        "fedex.com", 
        "inksdata.com", 
        "oyodomo.com", 
        "aweber.com", 
        "abcnews.go.com", 
        "vimeo.com", 
        "hootsuite.com", 
        "bleacherreport.com", 
        "lowes.com", 
        "yellowpages.com", 
        "americanexpress.com", 
        "tube8.com", 
        "yieldmanager.com", 
        "salesforce.com"
    ];
    var readyToDispose = false;
    var _testsRemaining = 1000;
    var openRequest;
    var lastSeen;
    var lastSeenStartTime;
    function disposePage() {
        openRequest.close();
        openRequest = null;
        readyToDispose = false;
    }
    function _tryNextText() {
        if(openRequest != null) {
            //if (readyToDispose) {
            //  disposePage();
            //  return false;
            //}
            if(lastSeen == openRequest) {
                var elapsed = Date.now() - lastSeenStartTime;
                if(elapsed > 10000) {
                    console.log(format("PAGE LOAD TIMEOUT! aborting url={0},  pageLen={1}", openRequest.url, openRequest.content.length));
                    //timed out, next loop will reacquire
                    openRequest.stop();
                    //openRequest.close();
                    //openRequest = null;
                    //lastSeen = null;
                    //lastSeenStartTime = null;
                                } else {
                    //not yet timed out
                    return false;
                }
            } else {
                //set our last seen then wait for next loop
                lastSeen = openRequest;
                lastSeenStartTime = Date.now();
            }
            return false;
        }
        var index = _testsRemaining % testUrls.length;
        var targetUrl = "http://www." + testUrls[index];
        _testsRemaining--;
        if(_testsRemaining <= 0) {
            console.log("TESTS COMPLETE!  check your memory usage");
            clearInterval(loopHandle);
            return false;
        }
        console.log(format("[{0}] = {1} starting...", _testsRemaining, testUrls[index]));
        var thisPage = require("webpage").create();
        openRequest = thisPage;
        openRequest.onLoadFinished = function (status) {
            if(openRequest == thisPage) {
                console.log(format("got page, url ={0}, targetUrl={1}  pageLen={2}", openRequest.url, targetUrl, openRequest.content.length));
                //readyToDispose = true;
                openRequest.stop();
                disposePage();
            } else if(openRequest == null) {
                console.log("ERROR? page opened while openRequest==null,  pageurl=" + targetUrl);
                //phantom.exit(-1);
                        } else {
                console.log(format("ERROR!  WRONG PAGE OPEN! got page, openPageurl ={0}, targetUrl={1}  pageLen={2}", openRequest.url, targetUrl, openRequest.content.length));
                phantom.exit(-1);
            }
        };
        openRequest.open(targetUrl);
        return true;
    }
    testUrls.length = _testsRemaining > testUrls.length ? testUrls.length : _testsRemaining;
    console.log("running tests, count = " + _testsRemaining);
    console.log("setting interval ");
    var loopHandle = setInterval(function () {
        _tryNextText();
    }, 500);
    
    
    

    PS: run that script for long enough (usually around 400 page loads) and the phantomjs exe crashes, sometimes silently, sometimes with segfaults

    Bug Qt/Webkit 
    opened by jasonswearingen 81
  • Switch to Python 3

    Switch to Python 3

    Given that Python 2 support ended in 2019 and major Linux distributions will switch to Python 3 soon, for example, Python 2 and its related packages will be removed in Fedora 32, I suggest to upgrade our ./test/run-tests.py to Python 3. WebKit is also migrating to Python 3.

    meta 
    opened by vitallium 0
  • post.js example is outdated

    post.js example is outdated

    1. Which version of PhantomJS are you using? Tip: run phantomjs --version.

    2.1.1

    1. What steps will reproduce the problem?

    To reproduce:

    1. Run phantomjs on phantomjs/examples/post.js

    Expected result: a valid response. Actual response: 404 not found

    1. Which operating system are you using?

    OS X

    1. Did you use binary PhantomJS or did you compile it from source?

    Installed via homebrew

    1. Please provide any additional information below.

    Running it via postman also didn't work. My suspicion is that posttestserver.com itself has changed, and that the previously valid example no longer works.

    pinned 
    opened by agrimm 2
  • Archiving the project: suspending the development

    Archiving the project: suspending the development

    Due to the lack of active contribution, I am going to archive this project soon.

    At some point in the future, if we pick up the development again (such as #15341, #15342, #15343), the project will be unarchived.

    With that, all the earlier plans regarding PhantomJS 2.5 (from @Vitallium) or 2.1.x (from @pixiuPL) will be abandoned effective immediately. Consequently, the source and binary packages for the above abandoned version will be removed to avoid any confusions. PhantomJS version 2.1.1 will remain the last known stable release until further notice.

    To keep the source repository in a sane situation:

    • the master branch will be preserved under the new bleeding-edge branch.
    • after that, the master branch will be restored back to the approximate state of v2.1.1

    That way, if anyone wants to improve PhantomJS for their own usages (internal fork, in-house patches), the master branch can still serve as a good baseline. It can still be built from source and it will still work on macOS, Linux, and Windows.

    Once the project is archived, no new issue can be filed. However, feel free to use the mailing-list to post questions and discuss any relevant topics.

    Thank you for your understanding!

    meta 
    opened by ariya 1
  • Use Read the Docs (RTD) for the documentation

    Use Read the Docs (RTD) for the documentation

    opened by ariya 0
  • Increasing maintenance capacity

    Increasing maintenance capacity

    This is a meta-discussion to collect ideas on how to increase the maintenance effort of PhantomJS.

    For the background, please read the previous issue #14541 on Communicating maintenance capacity and prioritization.

    Other related issues:

    • #14543 Lowering the barrier to contribution
    • #13861 How I can help PhantomJS development?
    meta 
    opened by ariya 3
  • Lowering the barrier to contribution

    Lowering the barrier to contribution

    This is related to #13861 and #14541.

    There are many different ways to contribute to PhantomJS: fix a defect, propose an enhancement, triage issues, write documentation, help setting up infrastructure, or even fund someone to work on PhantomJS.

    If you would like to contribute to PhantomJS but you haven't done that yet, please let us know why. Even better if we can start the discussion on how to lower those barriers.

    meta 
    opened by ariya 9
Owner
Ariya Hidayat
Open-source
Ariya Hidayat
Vimb - the vim like browser is a webkit based web browser that behaves like the vimperator plugin for the firefox and usage paradigms from the great editor vim.

Vimb - the vim like browser is a webkit based web browser that behaves like the vimperator plugin for the firefox and usage paradigms from the great editor vim. The goal of vimb is to build a completely keyboard-driven, efficient and pleasurable browsing-experience.

Daniel Carl 1.2k Nov 16, 2022
A Minimal Web Browser with Built-in Adblocker in Less Than 100 Lines of Code

A Minimal QtWebEngine Web Browser with Adblocker How Does It Work This is a minimal network filter implementation using QWebEngineUrlRequestIntercepto

Penk Chen 19 Jul 23, 2022
Filter and launch links in a browser of your choice!

Link Launcher Filter links with regular expressions and launch them into your favourite browsers Have you ever wanted to open a youtube link from othe

null 5 Aug 20, 2021
A homebrew browser that's actually good.

Better Homebrew Browser The homebrew browser that's actually good. Massive thanks to GrapheneCt on his work on ScePaf. Features It is the second ever

Ibrahim 64 Nov 15, 2022
an easy-to-use cross platform web browser controller for C++

WebBrowser++ 这是一个基于C++17的唯头文件跨平台浏览器控制库。 您只需要将本目录下的Include文件夹拷贝至您的项目中即可使用。如果使用CMake编译,则可直接include_directories(Include),也可以模仿本项目的CMakeLists.txt进行编写。 建立该

null 8 Nov 17, 2021
Surf - simple webkit-based browser

Surf - simple webkit-based browser

Johannes Hove-Henriksen 1 Nov 21, 2021
A modern ESM build of the Potrace library for use in the browser.

ESM Potrace Wasm A modern ESM build of the Potrace library for use in the browser. Installation npm install --save esm-potrace-wasm Usage import potra

Thomas Steiner 40 Nov 5, 2022
An easy programming language that runs in the browser

easylang.online An easy programming language that runs in the browser Website easylang.online Build in Linux Dependencies Download Emscripten SDK and

chkas 73 Nov 4, 2022
An old-style web browser stub, comes from Internet Explorer was genocided on Windows.

Outernet Explorer An old-style web browser stub, comes from Internet Explorer was genocided on Windows. Download from: https://github.com/kekyo/Outern

Kouji Matsui 11 Oct 14, 2022
QtWebKit-based web browser on Linux framebuffer.

FBrowser QtWebKit-based web browser on Linux framebuffer. Security Notes This browser is not intended for visiting untrusted websites. By default, OSB

null 22 Nov 7, 2022
Browser and NodeJS Web Assembly audio decoder libraries that are highly optimized for size and performance.

WASM Audio Decoders WASM Audio Decoders is a collection of Web Assembly audio decoder libraries that are highly optimized for browser use. Each module

Ethan Halsall 70 Oct 29, 2022
Template for C++ GUI apps that can run in the browser

GGWeb Template for making a GUI app with C++ / Dear ImGui / SDL / OpenGL / Emscripten that can run both natively and in the browser. Example: https://

Georgi Gerganov 22 Nov 21, 2022
Clean tab-less browser based on webkit2 and GTK4.

Rose Browser Simple browser based on webkit2-5.0/GTK4. Showcase Requirements In order to build rose you need gtk4 and webkit2gtk-5.0. In order to use

Rosé 275 Nov 19, 2022
A static C library to build applications for the Foenix retro computers, and, eventually, a single-tasking operating system and file browser that sits atop the Foenix MCP Kernel

@mainpage Foenix A2560 Foenix Retro OS: fr/OS A2560-FoenixRetroOS This project provides 2 things: A static C library/framework that anyone can use to

null 4 Jun 24, 2022
Passive scriptable LED server for Raspberry Pi

Passive LED server Scriptable LED server that you can just keep running all the time on a Raspberry Pi. Requirements Raspberry Pi 4 or newer (older mi

Melissa 4 Dec 1, 2021
m8c is a client for Dirtywave M8 tracker's headless mode.

m8c is a client for Dirtywave M8 tracker's headless mode. The application should be cross-platform ready and can be built in Linux, Windows (with MSYS2/MINGW64) and Mac OS.

Jonne Kokkonen 179 Nov 9, 2022
BRAW decoder to allow unattended, headless, conversion of *.braw files into other file formats.

BRAW Decode This is a project that uses the official Blackmagic Raw SDK to decode a *.braw file in a way that can be read by FFmpeg. The goal of the p

Shelby Jueden 11 Oct 5, 2022
Vimb - the vim like browser is a webkit based web browser that behaves like the vimperator plugin for the firefox and usage paradigms from the great editor vim.

Vimb - the vim like browser is a webkit based web browser that behaves like the vimperator plugin for the firefox and usage paradigms from the great editor vim. The goal of vimb is to build a completely keyboard-driven, efficient and pleasurable browsing-experience.

Daniel Carl 1.2k Nov 16, 2022
A collection of tools to abuse chrome browser

A collection of tools to abuse chrome browser

batsec 266 Nov 14, 2022
Ultra-lightweight web browser based on Qt Ultralight webview, powered by Ultralight HTML renderer

Qt Ultralight Browser This is an ultra-lightweight web browser powered by the Ultralight web engine embedded in Qt 5 app as a custom webview widget -

niu tech 41 Nov 12, 2022