我正在使用命令
启动我的扩展程序的chromegoogle-chrome --remote-debugging-port=9222 --disable-setuid-sandbox --no-sandbox --load-extension=dummyextension --ignore-certificate-errors
一般情况下,当我启用开发者模式并点击检查视图时,我会看到我的扩展程序发出的所有请求。有没有办法在木偶操作员的帮助下阅读这些网络请求。
我正在尝试阅读以下网络请求:
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());
});
})();
但我只看到github页面的请求,而不是我的扩展程序发出的请求。
答案 0 :(得分:1)
您是否尝试过(来自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'