2022-08-15

How to overwrite the User-Agent Client Hints in puppeteer?

I am facing an issue with dealing with the user-agent-client-hints. If you have no idea what User-agent-client-hints are then think of them as some request headers. (See the image below) enter image description here

I tried to overwrite the request headers with the code below but it does not work

await page.setRequestInterception(true)
await page.on('request', (req) => {
    const headers = req.headers()
    headers['sec-ch-ua'] = 'some thing new'
    req.continue({
        headers
    })
})


No comments:

Post a Comment