-
Notifications
You must be signed in to change notification settings - Fork 320
Log network requests
Andrea Cardaci edited this page Nov 23, 2016
·
6 revisions
Navigate to https://github.com, log all the requests made by the browser and exit when the page is fully loaded.
const CDP = require('chrome-remote-interface');
CDP(function (client) {
client.Network.requestWillBeSent(function (params) {
console.log(params.request.url);
});
client.Page.loadEventFired(function () {
client.close();
});
client.Network.enable();
client.Page.enable();
client.once('ready', function () {
client.Page.navigate({'url': 'https://github.com'});
});
}).on('error', function (err) {
console.error('Cannot connect to remote endpoint:', err);
});