Reputation: 865
I am launching chrome with my extension using the command
google-chrome --remote-debugging-port=9222 --disable-setuid-sandbox --no-sandbox --load-extension=dummyextension --ignore-certificate-errors
Generally i would see all the requests made by my extension when i enable developer mode and click on inspect views. Is there a way to read those network requests with help of puppeteer.
I am trying to read the network requests like below:
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.connect({browserWSEndpoint :'ws://localhost:9222/devtools/browser/e27e967f-711' });
const page = await browser.newPage();
await page.goto('https://github.com');
await page.setRequestInterception(true);
page.on('request', request => {
request.continue(); // pass it through.
});
page.on('response', response => {
const req = response.request();
console.log( response.status(), req.url());
});
})();
But i see the requests only for the github page but not the requests made by my extension.
Upvotes: 1
Views: 1221
Reputation: 6713
Did you try (from debugging tips)
# Basic verbose logging
env DEBUG="puppeteer:*" node script.js
# Debug output can be enabled/disabled by namespace
env DEBUG="puppeteer:*,-puppeteer:protocol" node script.js # everything BUT protocol messages
env DEBUG="puppeteer:session" node script.js # protocol session messages (protocol messages to targets)
env DEBUG="puppeteer:mouse,puppeteer:keyboard" node script.js # only Mouse and Keyboard API calls
# Protocol traffic can be rather noisy. This example filters out all Network domain messages
env DEBUG="puppeteer:*" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '"Network'
Upvotes: 2