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

305
Vistas
Puppeteer failed to handle SSO popup only in headless mode ( In non-headless it goes smooth )

My code :

const puppeteer = require('puppeteer');

(async () => {
    const browser = await puppeteer.launch({
        headless: true,
        args : [
            --user-agents='view below'
        ]
    });
    const page = await browser.newPage();
    await page.goto('website that has sso login', {
        waitUntil: 'networkidle0',
    });
    //tried adding or replacing with waitForSelector
    await page.click('#button_to_open_sso_popup');
    const [ popup ] = await Promise.all([
        new Promise((resolve) => page.once('popup', resolve)),
    ]);
    await popup.waitForNavigation({
        waitUntil: 'networkidle0' //tried default load, ...
    });
    //type in email and password to login then do stuff
    await browser.close();
})();;

In non-headless mode it works fine

In headless mode i always get navigation timed out

TimeoutError: Navigation timeout of 30000 ms exceeded
    at C:\Users\DW\node_modules\puppeteer\lib\cjs\puppeteer\common\LifecycleWatcher.js:106:111
    at async FrameManager.waitForFrameNavigation (C:\Users\DW\node_modules\puppeteer\lib\cjs\puppeteer\common\FrameManager.js:167:23)   
    at async Frame.waitForNavigation (C:\Users\DW\node_modules\puppeteer\lib\cjs\puppeteer\common\FrameManager.js:524:16)
    at async Page.waitForNavigation (C:\Users\DW\node_modules\puppeteer\lib\cjs\puppeteer\common\Page.js:1229:16)
    at async handleSSO (C:\Users\DW\Documents\Code Work\puppeteer_test\fptu_schedule_chat_bot\main.js:65:5)
    at async main (C:\Users\DW\Documents\Code Work\puppeteer_test\fptu_schedule_chat_bot\main.js:33:5)

I have went through similar question and tried using these user agents ( not solving my problem ):

    Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
    Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36
    Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36

I added an issue on github repo if you are interested : https://github.com/puppeteer/puppeteer/issues/7775

about 4 years ago · Juan Pablo Isaza
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