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
  • docs: Fix a few typos

    docs: Fix a few typos

    There are small typos in:

    • src/qcommandline/qcommandline.cpp
    • src/qcommandline/qcommandline.h
    • src/repl.cpp
    • src/webpage.h

    Fixes:

    • Should read backward rather than backgward.
    • Should read switches rather than switchs.
    • Should read invocable rather than invokable.

    Semi-automated pull request generated by https://github.com/timgates42/meticulous/blob/master/docs/NOTE.md

    opened by timgates42 0
  • 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
Owner
Ariya Hidayat
Open-source
Ariya Hidayat
Scriptable Development Environment for VSCode

Scriptable Development Environment This project includes Scriptable types generated from documentation page RUN SCRIPT hotkey: ⌘ + SHIFT + B, it will

Slavik Nychkalo 80 Dec 29, 2022
Simple implementation of markup for Scriptable widgets.

Widget Markup Write Scriptable widgets with markup. Installation Just import the library script to your scriptable widget file. const {widgetMarkup, c

Rafael Gandionco 32 Nov 22, 2022
TrySomethingNewWidget - A script for the iOS app called "Scriptable" prompting you with new ideas for things to try daily!

TrySomethingNewWidget A script for the iOS app called "Scriptable" prompting you with new ideas for things to try daily! (Beware that the small widget

Mathias Guldfeldt 2 Jul 11, 2022
Insanely fast, full-stack, headless browser testing using node.js

Zombie.js Insanely fast, headless full-stack testing using Node.js The Bite If you're going to write an insanely fast, headless browser, how can you n

Assaf Arkin 5.6k Dec 22, 2022
Headless Chrome Node.js API

Puppeteer API | FAQ | Contributing | Troubleshooting Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over th

Puppeteer 81.4k Jan 1, 2023
A simple and stable cross-browser testing tool. 简单稳定的跨浏览器测试工具。

totoro A simple and stable cross-browser testing tool. Latest stable version: v2.0 Change Log 中文版使用文档 0. Features Run in real browsers Support all tes

totoro 568 Dec 21, 2022
Next-gen browser and mobile automation test framework for Node.js

Next-gen browser and mobile automation test framework for Node.js. Homepage | Developer Guide | API Reference | Contribute | Changelog | Roadmap Webdr

WebdriverIO 7.9k Jan 3, 2023
A scriptable browser like PhantomJS, based on Firefox

SlimerJS http://slimerjs.org/ SlimerJS is a scriptable browser. It allows you to manipulate a web page with an external Javascript script: opening a w

Laurent Jouanneau 3k Dec 31, 2022
Scriptable Development Environment for VSCode

Scriptable Development Environment This project includes Scriptable types generated from documentation page RUN SCRIPT hotkey: ⌘ + SHIFT + B, it will

Slavik Nychkalo 80 Dec 29, 2022
A swiss army knife with lots of tools, extensions and (scriptable) enhancements for Visual Studio Code.

vscode-powertools A swiss army knife with lots of tools, extensions and (scriptable) enhancements for Visual Studio Code. ⚠️ ⚠️ ⚠️ NOTICE: If you have

e.GO Mobile 44 Nov 24, 2022
Simple implementation of markup for Scriptable widgets.

Widget Markup Write Scriptable widgets with markup. Installation Just import the library script to your scriptable widget file. const {widgetMarkup, c

Rafael Gandionco 32 Nov 22, 2022
TrySomethingNewWidget - A script for the iOS app called "Scriptable" prompting you with new ideas for things to try daily!

TrySomethingNewWidget A script for the iOS app called "Scriptable" prompting you with new ideas for things to try daily! (Beware that the small widget

Mathias Guldfeldt 2 Jul 11, 2022
A library to log for Scriptable.

scriptable-logger Logger is a library to log for Scriptable. Usage const Logger = importModule('logger'); Logger.log('log'); // 'log' in white color.

Kynako 1 Apr 29, 2022
Collection of Scriptable scripts.

Scriptable Scripts GitLab Contribution Graph A widget that shows an overview of your recent GitLab contributions. It is available in small and medium

Shahab 3 Nov 18, 2022
PoGOEvents is a Scriptable widget that displays current and upcoming Pokemon GO events.

PoGOEvents PoGOEvents is a Scriptable widget that displays current and upcoming Pokemon GO events. All event data is gathered from from ScrapedDuck, w

Anthony 33 Nov 12, 2022
Scriptable Widget which shows current news from tagesschau.de

tagesschau-widget for Scriptable Based on this reddit post of u/trbn_hck Unfortunately the Repositorie in his GitHub profile is no longer exist. Widge

Robinson 5 Sep 12, 2022
Use jsx to make scriptable's layout.

scriptable-jsx This project helps you to write Scriptable widgets with JSX syntax. And add some useful tools by the way. you can check demos in demo f

毛球 8 Oct 10, 2022
Insanely fast, full-stack, headless browser testing using node.js

Zombie.js Insanely fast, headless full-stack testing using Node.js The Bite If you're going to write an insanely fast, headless browser, how can you n

Assaf Arkin 5.6k Dec 22, 2022
Evaluate JavaScript on a URL through headless Chrome browser.

jseval Evaluate JavaScript on a URL through headless Chrome browser. build docker build -t jseval -f jseval.dockerfile . usage docker run --rm jseval

Fumiya A 22 Nov 29, 2022
Purple haze is a TypeScript, Markdown, JS generative bundler that works in headless browser

Purple haze Inspired by generative programming and weed :). So I was learning Elm language at home usually in the evening and now I am missing all thi

Aexol 6 Nov 13, 2022