Skip to content

Instantly share code, notes, and snippets.

@hendrixroa
Created March 8, 2023 01:40
Show Gist options
  • Save hendrixroa/4a3d9f3b198cf6543c180bd08b549157 to your computer and use it in GitHub Desktop.
Save hendrixroa/4a3d9f3b198cf6543c180bd08b549157 to your computer and use it in GitHub Desktop.
Initialize browser headless
private async initBrowser() {
const browserArgs: PuppeteerLaunchOptions = {
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--disable-web-security',
'--disable-infobars',
'--window-position=0,0',
'--ignore-certifcate-errors',
'--ignore-certifcate-errors-spki-list',
],
};
this.browser = await Puppeteer.launch(browserArgs);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment