Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
How to keep current browser data on headless:true mode in puppeteer

I've a puppeteer script which works as expected when it's headless:false mode with Google Chrome profile and executablePath because I need to keep all sessions and browser data every time when I use the script, it also has chrome extension which works on the script browser profile.

But when I only make change to headless:true mode, same script doesn't work as before, it doesn't remember all browser data(sessions), and doesn't recognize my browser extension.

Here is the script code,

const puppeteer = require('puppeteer-extra');
const StealthPlugin = require('puppeteer-extra-plugin-stealth')
puppeteer.use(StealthPlugin())

const browser = await puppeteer.launch({
    headless: true,
    ignoreHTTPSErrors: true,
    executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
    args: [
      '--user-data-dir=/Users/x/Library/Application Support/Google/Chrome/Profile 2',
      '--window-size=1920,1080',
      "--no-sandbox",
      //"--disable-setuid-sandbox",
      "--disable-dev-shm-usage",
      "--disable-gpu",
      "--disable-extensions",
      "--disable-dev-tools",
      "--disable-infobars",
      "--ignore-certificate-errors",
      "--enable-logging",
      "--v=1",
      '--disable-setuid-sandbox',
      '--disable-infobars',
      '--window-position=0,0',
      '--ignore-certifcate-errors',
      '--ignore-certifcate-errors-spki-list',
      '--user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36'
    ]
  });
  const page = await browser.newPage();

Is there anyway that I can keep using my script with no problem on headless:true mode or should I run the script like browser open all the time on a VDS machine :/

Thanks.

Information

https://github.com/puppeteer/puppeteer/issues/921

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!