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

442
Views
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 answers
Answer question

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 Report
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!