- 檔案系統模組
- PhantomJS - 屬性
- PhantomJS - 方法
- 系統模組
- PhantomJS - 屬性
- Web 伺服器模組
- PhantomJS - 屬性
- PhantomJS - 方法
- 其他
- 命令列介面
- PhantomJS - 螢幕截圖
- PhantomJS - 網頁自動化
- PhantomJS - 網路監視
- PhantomJS - 測試
- PhantomJS - REPL
- PhantomJS - 例項
- PhantomJS 有用資源
- PhantomJS - 快速指南
- PhantomJS - 有用資源
- PhantomJS - 討論
PhantomJS - onResourceError()
當網頁無法上傳檔案時呼叫此回撥。其引數是錯誤物件。
錯誤物件包含以下內容:
Id - 請求的編號。
URL - 呼叫的 URL。
ErrorCode - 錯誤程式碼。
ErrorString - 錯誤詳情
語法
語法如下:
wpage.onResourceError = function(resourceError) {}
示例
以下示例演示了 onResourceError() 方法的使用。
var wpage = require('webpage').create();
wpage.onResourceError = function(error) {
console.log(JSON.stringify(error));
}
wpage.open('https:///tasks/prompt1.html', function(status) {
});
上述程式生成以下 輸出。
{"errorCode":203,"errorString":"Error downloading https:///tasks/prompt
.html - server replied: Not Found","id":1,"status":404,"statusText":"Not Found",
"url":"https:///tasks/prompt1.html"}
phantomjs_webpage_module_events_callbacks.htm
廣告