函数
- page.childframescount
- page.childframesname
- page.close
- page.currentframename
- page.deletelater
- page.destroyed
- page.evaluate
- page.initialized
- page.injectjs
- page.javascriptalertsent
- page.javascriptconsolemessagesent
- page.loadfinished
- page.loadstarted
- page.openurl
- page.release
- page.render
- page.resourceerror
- page.resourcereceived
- page.resourcerequested
- page.uploadfile
- page.sendevent
- page.setcontent
- page.switchtochildframe
- page.switchtomainframe
- page.switchtoparentframe
- page.addcookie
- page.deletecookie
- page.clearcookies
回调处理程序/
列表中的所有页面的事件:
- oninitialized
- onloadstarted
- onloadfinished
- onurlchanged
- onnavigationrequested
- onrepaintrequested
- onresourcerequested
- onresourcereceived
- onresourceerror
- onresourcetimeout
- onalert
- onconsolemessage
- onclosing
| function() { | |
| arguments); | |
| }; | |
| function() { | |
| arguments); | |
| }; | |
| function() { | |
| arguments); | |
| }; | |
| function() { | |
| arguments); | |
| }; | |
| function() { | |
| arguments); | |
| }; | |
| function() { | |
| arguments); | |
| }; | |
| true) { | |
| function() { | |
| arguments); | |
| }; | |
| function() { | |
| arguments); | |
| }; | |
| } | |
| function() { | |
| arguments); | |
| }; | |
| // window.console.log(msg); | |
| function() { | |
| arguments); | |
| }; | |
| // window.alert(msg); | |
| function() { | |
| arguments); | |
| }; | |
| // var confirmed = window.confirm(msg); | |
| function() { | |
| arguments); | |
| }; | |
| // var user_value = window.prompt(msg, default_value); | |
| function() { | |
| arguments); | |
| }; | |
| //////////////////////////////////////////////////////////////////////////////// | |
| function() { | |
| open(step1url); | |
| 0); | |
| function() { | |
| open(step2url); | |
| 5000); | |
| function() { | |
| function() { | |
| true); | |
| dispatchEvent(ev); | |
| }); | |
| 10000); | |
| function() { | |
| function() { | |
| true); | |
| dispatchEvent(ev); | |
| }); | |
| 15000); | |
| function() { | |
| close(); | |
| function(){ | |
| exit(); | |
| 100); | |
| 20000); |
网络监控
var page = require('webpage').create(); page.onResourceRequested = function(request) { console.log('Request ' + JSON.stringify(request, undefined, 4)); }; page.onResourceReceived = function(response) { console.log('Receive ' + JSON.stringify(response, undefined, 4)); }; page.open(url);