我正在使用puppeteer-stealth并尝试在发出请求时保持与浏览器窗口相同的标题。下面的代码在新选项卡中打开,并且没有相同的标题。预先谢谢你
await this.page.setRequestInterception(true);
// 2. Intercept request
this.page.once("request", async (request) => {
// 3. Make request using Node.js
const response = await got(request.url(), {
// HTTP proxy.
//agent: new HttpProxyAgent("http://127.0.0.1:3000"),
body,
method: POST,
json: true,
retry: 0,
throwHttpErrors: false,
});
// 4. Return response to Chrome
await request.respond({
body: response.body,
headers: response.headers,
status: response.statusCode,
});
});
interceptedRequest.continue(data);