-
-
Notifications
You must be signed in to change notification settings - Fork 141
Events
phantomas core uses EventEmitter, well known from nodejs, to trigger events each module can attach handlers to.
In the order of triggering. Refer to PhantomJS events docs.
fired before the page is requested.
fired just after page is requested.
Loading of the page has just started.
Not fired when in
--disable-js
mode
PhantomJS page was created, but URL is not yet loaded. You can now try to inject custom JavaScript code in the page environment.
Page is successfully loaded.
Page failed to load.
Triggered just before the final report is generated. The last chance to add or modify a metric.
HTTP request was sent (request object from phantomJS is passed to the listener).
phantomas.on('onResourceRequested', function(res) { /* ... */ });
Emitted just before HTTP request is sent.
phantomas.on('beforeSend', function(entry, res) {
entry.block(); // call to block the request
});
HTTP request was sent (additional request data is passed to the listener).
phantomas.on('send', function(entry, res) { /* ... */ });
Chunk of the response was received (response object from phantomJS is passed to the listener).
phantomas.on('onResourceReceived', function(res) { /* ... */ });
The whole response was received (additional response data is passed to the listener).
phantomas.on('recv', function(entry, res) { /* ... */ });
The base64-encoded response was received (additional response data is passed to the listener).
phantomas.on('base64recv', function(entry, res) { /* ... */ });
Emitted when console.log
is called from within the page.
console.log('%s: %s', 'foo', 123);
phantomas.on('consoleLog', function(msg, data) {
// msg = 'foo: 123'
// data = ['%s: %s', 'foo', 123]
});
Emitted when JavaScript error occurs
phantomas.on('jserror', function(msg, trace) { /* ... */ });
Emitted when alert()
function is called
phantomas.on('alert', function(msg) { /* ... */ });
Emitted when confirm()
function is called
phantomas.on('confirm', function(msg) { /* ... */ });
Emitted when prompt()
function is called
phantomas.on('prompt', function(msg) { /* ... */ });