+
Skip to content

tomoyo/phantomjs

 
 

Repository files navigation

PhantomJS 2.1 - Scriptable Headless WebKit

Support download files

    page.onResourceReceived = function(response) {
    	if(response.contentType =="application/zip"){
    	 	var filename = response.headers[5].value.match(/"(.+?)"/)[1];
    	 	var responseNumber = filename.match(/\d+-\d+/)[0];
    	  	page.onFilePicker = function(){
    		 	console.log("save file:"+filename);
    		    return filename;
    		}
        }
    }

    page.onDownloadFinished = function(status){
    	console.log('onDownloadFinished(' + status + ')');
    }
    page.onLoadFinished = function(status){
        console.log('onLoadFinished(' + status + ')');
    }

page.onInitialized on every frame

    page.onInitialized = function() {

        console.log("INIT ON A FRAME");

    };

PhantomJS - Scriptable Headless WebKit

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

Note: Please do not create a GitHub pull request without reading the Contribution Guide first. Failure to do so may result in the rejection of the pull request.

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 Ariya Hidayat (Twitter: @ariyahidayat), with the help of many contributors. Follow the official Twitter stream @PhantomJS to get the frequent development updates.

About

Support download files for phantomjs 2.1 version

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 82.0%
  • JavaScript 6.2%
  • C++ 5.1%
  • C 3.1%
  • Java 2.2%
  • Python 1.1%
  • Other 0.3%
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载