
- 文件系统模块
- PhantomJS - 属性
- PhantomJS - 方法
- 系统模块
- PhantomJS - 属性
- Web 服务器模块
- PhantomJS - 属性
- PhantomJS - 方法
- 其他
- 命令行界面
- PhantomJS - 屏幕捕获
- PhantomJS - 页面自动化
- PhantomJS - 网络监视
- PhantomJS - 测试
- PhantomJS - REPL
- PhantomJS - 示例
- PhantomJS 有用资源
- PhantomJS - 快速指南
- PhantomJS - 有用资源
- PhantomJS - 讨论
PhantomJS - stop()
stop() 方法有助于停止页面加载。
语法
其语法如下 −
var wpage = require('webpage').create(); wpage.stop();
示例
var wpage = require('webpage').create(); wpage.onLoadStarted = function() { wpage.stop(); } wpage.open('http://localhost/tasks/wopen2.html', function(status) { console.log(status); phantom.exit(); });
以上程序生成以下输出。
Fail
在以上示例中,我们使用 onLoadStarted 事件来停止页面继续加载。由于该页面已停止加载,因此我们获得的状态为失败。
phantomjs_webpage_module_methods.htm
广告