No new page is created when clicking to open a PDF in headless mode

In headless=False (headed mode):

  • We click an element (e.g., a file name like ProjectAttachedFile1.pdf).
  • A new page is opened with the embedded PDF viewer.
  • Switch Page NEW works correctly, and we can access the PDF and download it.

In headless=True:

  • The click triggers no new page creation.
  • After running Switch Page NEW, we’re still on the same page (verified via ${pages}= Get Page Ids which shows only one).
  • As a result, the PDF page isn’t accessible, and download fails.

I think this has to do with the fact that Chromium does not use/support the internal PDF viewer in headless mode.
See also this Playwright thread [BUG] PDF Viewer does not work in headless Chromium and leads to download the file instead · Issue #6342 · microsoft/playwright · GitHub

1 Like