Quantcast
Channel: 万维网黑客 » phantomjs
Browsing all 10 articles
Browse latest View live

phantomjs 测试页面加载速度

var page = require('webpage').create(); var system = require('system'); var t,url; if(system.args.length === 1){ console.log('Usage: app.js <some URL>'); phantom.exit(); }else{ t = Date.now();...

View Article



phantomjs 不加载网页css js

var page = require('webpage').create(); var system = require('system'); if(system.args.length < 2){ console.log('Usage: app.js <URL>'); phantom.exit(); } var url = system.args[1];...

View Article

phantomjs 浏览器(不知道应该叫什么 看起来很厉害的样子)

var cb = function(data){ var list = data.query.results.movie; list.forEach(function(item){ console.log(item.title + ' [' + item.rating.MPAA.content + ']'); }); phantom.exit(); } var el =...

View Article

phantomjs 资源请求开始 结束回调函数

var page = require('webpage').create(); var system = require('system'); var url = ''; if(system.args.length === 1){ console.log('Usage: app.js <some URL>'); phantom.exit(1); }else{ url =...

View Article

phantomjs 页面事件

var sys = require('system'); var page = require('webpage').create(); page.onInitialized = function(){ console.log('++++++++++++++++++++++++++++\npage.onInitialized\n'); for(var i = 0; i <...

View Article


phantomjs 加载外部脚本

var page = require('webpage').create(); page.onConsoleMessage = function(msg){ console.log(msg); } page.open('http://www.phantomjs.org',function(status){ if(status === 'success'){...

View Article

phantomjs post提交数据

var page = require('webpage').create(); page.open('http://posttestserver.com/post.php?dump', 'post', 'universe=expanding&answer=42',function(status){ if(status !== 'success'){ console.log('Unable...

View Article

phantomjs 建立服务器测试post提交

var page = require('webpage').create(); var server = require('webserver').create(); var sys = require('system'); var data = 'name=hacker&email=admin@w3hacker.com'; if(sys.args.length !== 2){...

View Article


phantomjs 抓取webqq页面并保存到本地

var page = require('webpage').create(); var fs = require('fs'); page.open('http://web2.qq.com/', function(status){ if(status !== 'success'){ console.log('Unable to post!'); }else{...

View Article


phantomjs 截取腾讯首页导航条生成图片并保存到本地

var page = require('webpage').create(); page.onConsoleMessage = function(msg) { page.clipRect = JSON.parse(msg); page.render("qq.png"); }; page.open('http://www.qq.com/',function(status){ if(status ===...

View Article
Browsing all 10 articles
Browse latest View live


Latest Images