- 檔案系統模組
- 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('https:///tasks/wopen2.html', function(status) {
console.log(status);
phantom.exit();
});
以上程式生成以下輸出。
Fail
在以上示例中,我們使用 onLoadStarted 事件來停止頁面繼續載入。由於該頁面已停止載入,因此我們獲得的狀態為失敗。
phantomjs_webpage_module_methods.htm
廣告