Created
July 9, 2023 18:56
-
-
Save jeremyfrank/6c1901f1fa72824e17fae3313a29bef0 to your computer and use it in GitHub Desktop.
Puppeteer config for modal cookie suppression with Lighthouse CI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {puppeteer.Browser} browser | |
* @param {{url: string, options: LHCI.CollectCommand.Options}} context | |
*/ | |
module.exports = async (browser, context) => { | |
const cookies = [{ | |
name: 'COOKIE_NAME_HERE', | |
value: 'COOKIE_VALUE_HERE', | |
url: context.url, | |
}] | |
const page = await browser.newPage(); | |
await page.setCookie(...cookies); | |
await page.goto(context.url); | |
await page.close(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment