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

446
Vistas
headless mode playwright not working as inteded

hi I have a problem with my code, when I start my scraping code with playwright on headless mode: true when I reach a waitfornavitagion for a log in the program stops working and I don't know why cause when I start it in headless mode: false; I reach my final destination without errors. here is my code:

function ashScraping() {
  (async () => {
    const browser = await chromium.launch({
      headless: false,
      slowmo: 300,
      timeout: 70000,
      acceptDownloads: true,
    });
    const context = await browser.newContext();
    const page = await context.newPage();
    await page.goto('https://www.thePageImUsing.com/login');
    await page.locator('input[name="txtUserID"]').click();
    await page.locator('input[name="txtUserID"]').fill(`${user}`);
    await page.locator('input[name="txtPassword"]').click();
    await page.locator('input[name="txtPassword"]').fill(`${cont}`);
    await Promise.all([
      page.waitForNavigation(/*{ url: 'https://home.thePageImUsing.com' }*/),
      page.locator('text=login').click()
    ]);
    const [page1] = await Promise.all([
      page.waitForEvent('popup'),
      page.locator('something..something').click()
    ]);
    await page1.locator('input[name="txtShpno"]').click();
    await page1.locator('input[name="txtShpno"]').fill(`${bodega}`);
    await page1.locator('input:has-text("Buscar")').click();
    await Promise.all([
      page.waitForNavigation(/*{ url: 'home.thePageImUsing.com' }*/),
    ]);
    await page.locator('text=Artículos').click();
    await page.locator('text=Artículos').click();
    await page.locator('text=Artículos').click();
    await page.locator('text=Programa de clientes').click();
    await page.locator('#rdoWarehouse_0').check();
    await page.locator('#rdoAvailability_2').check();
    const [download] = await Promise.all([
      page.waitForEvent('download'),
      page.on('dialog', dialog => dialog.accept()),
      await page.locator('#cmdExport').click(),
    ]);
    const path = download.suggestedFilename();
    await download.saveAs(path);
    await context.close();
    await browser.close();
  })();
};

ashScraping();

so I modified some parts of the code for privacy reasons, but the context it's the same. I would welcome any answers that could point me to the error.

right now when I start the software in headless mode: true this is the error:

line 23: waitfornavigation: timeout.
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Can you check instead of wait for navigation: S1: click on url S2: and in next page check any element using wait for selector....

await Promise.all([
    page.click('.ffwHVz'),
    page.waitForSelector('.icon-User-Filled'),
  ]);
about 4 years ago · Juan Pablo Isaza Denunciar
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