Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

167
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda