- PhantomJS Tutorial
- PhantomJS - Home
- PhantomJS - Overview
- PhantomJS - Environment Setup
- PhantomJS - Object
- PhantomJS - Methods
- WebPage Module
- PhantomJS - Properties
- PhantomJS - Methods
- PhantomJS - Events/Callbacks
- PhantomJS - Child Process Module
- File System Module
- PhantomJS - Properties
- PhantomJS - Methods
- System Module
- PhantomJS - Properties
- Web Server Module
- PhantomJS - Properties
- PhantomJS - Methods
- Miscellaneous
- Command Line Interface
- PhantomJS - Screen Capture
- PhantomJS - Page Automation
- PhantomJS - Network Monitoring
- PhantomJS - Testing
- PhantomJS - REPL
- PhantomJS - Examples
- PhantomJS Useful Resources
- PhantomJS - Quick Guide
- PhantomJS - Useful Resources
- PhantomJS - Discussion
PhantomJS - onResourceError()
This callback is called when the webpage is not able to upload the file. The arguments to it is the error object.
The error object contains −
Id − The number of the request.
URL − The URL called.
ErrorCode − error code.
ErrorString − error details
Syntax
Its syntax is as follows −
wpage.onResourceError = function(resourceError) {}
Example
The following example shows the use of onResourceError() method.
var wpage = require('webpage').create(); wpage.onResourceError = function(error) { console.log(JSON.stringify(error)); } wpage.open('http://localhost/tasks/prompt1.html', function(status) { });
The above program generates the following output.
{"errorCode":203,"errorString":"Error downloading http://localhost/tasks/prompt .html - server replied: Not Found","id":1,"status":404,"statusText":"Not Found", "url":"http://localhost/tasks/prompt1.html"}
phantomjs_webpage_module_events_callbacks.htm
Advertisements