Skip to content

[Question] Download with headless: true works fine , but with headless: false not; plw 1.8.0 #5091

@osmenia

Description

@osmenia

Hi Team,

plw 1.8.0
with headless: false code works fine, but with headless: true only first element is downloaded.

plw 1.3.0
works fine with both params (headless: false & headless: true)

What could be a problem with 1.8.0?

tnx a lot

const playwright = require("playwright");

(async () => {
  const browser = await playwright.chromium.launch({ headless: false });
  const context = await browser.newContext({
    acceptDownloads: true,
  });
  const page = await context.newPage();
  await page.goto(
    "https://file-examples.com/index.php/sample-documents-download/sample-xls-download/"
  );

  const handles = await page.$$("#table-files .file-link");

  for (let num of handles) {
    const [download] = await Promise.all([
      page.waitForEvent("download"), // wait for download to start
      (await num.$("a.btn")).click(),
    ]);
    const path = await download.path();
    console.log(path);
  }
  await browser.close();
})();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions