- 檔案系統模組
- PhantomJS - 屬性
- PhantomJS - 方法
- 系統模組
- PhantomJS - 屬性
- 網路伺服器模組
- PhantomJS - 屬性
- PhantomJS - 方法
- 其他
- 命令列介面
- PhantomJS - 螢幕捕獲
- PhantomJS - 頁面自動化
- PhantomJS - 網路監控
- PhantomJS - 測試
- PhantomJS - REPL
- PhantomJS - 示例
- PhantomJS 有用資源
- PhantomJS - 快速指南
- PhantomJS - 有用資源
- PhantomJS - 討論
PhantomJS - onClosing()
此方法會在視窗被關閉時呼叫,可能是使用 page.close() 函式或 window.close() 函式關閉的。
語法
其語法如下 −
var wpage = require('webpage').create();
wpage.onClosing = function(str) {}
示例
var wpage = require('webpage').create();
wpage.onClosing = function(str) {
console.log("page is closed");
}
wpage.open('https:///tasks/closing.html', function(status) {
console.log(status);
wpage.close();
});
上述程式會生成以下 輸出。
success page is closed
phantomjs_webpage_module_events_callbacks.htm
廣告