Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Use the browser download flow when the server sends a downloadable PDF: subscribe to the download event before clicking, save the download to a permanent path, and verify the file before the browser context closes. An inline PDF opened in the browser and a PDF printed from an HTML page are different cases. Robot Framework Browser Library, powered by Playwright, handles each one differently.

First identify which PDF your application returns

Before choosing a keyword, observe what the action does:

  • Browser download: clicking a link or submitting a form emits a download event. The server-delivered file is what you want to preserve.
  • Inline PDF: the browser navigates to a PDF URL and displays its built-in viewer. This is still the server’s document, not a page that should be printed again.
  • Page print: the application leaves you on HTML and you need a newly generated PDF of the rendered page.

Only the first case uses Playwright’s Download API. Using a page-print keyword for an inline response can produce a PDF of the viewer or an unrelated HTML page rather than the original bytes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install Browser Library and its browsers

The current official setup guide describes Python 3.7 or newer, Node.js, the robotframework-browser package, and the browser initialization command. Treat these as the guide’s current setup description; verify requirements when upgrading.

#1 Best Overall
PDF Extra 2024| Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Lifetime License | 1 Windows PC | 1 User [PC Online code]
  • EDIT text, images & designs in PDF documents. ORGANIZE PDFs. Convert PDFs to Word, Excel & ePub.
  • READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.
  • CREATE, COMBINE, SCAN and COMPRESS PDFs
  • FILL forms & Digitally Sign PDFs. PROTECT and Encrypt PDFs
  • LIFETIME License for 1 Windows PC or Laptop. 5GB MobiDrive Cloud Storage Included.
  1. Install Node.js on the machine that runs Robot Framework.
  2. Install the Python package: pip install robotframework-browser.
  3. Install Playwright’s Node and browser dependencies: rfbrowser init.

Keep the package and initialized browser binaries in the same environment used by your CI job. A locally initialized browser does not automatically exist in a clean CI worker.

Save a server-triggered PDF download

A download is owned by its browser context. Playwright removes temporary download files when that context closes, so save the file to your chosen destination before teardown. The reliable sequence is: register for the event, trigger the action, await the event, save it, then assert the result.

Robot Framework workflow

Browser Library keyword names and argument shapes can vary by installed version. The following shows the required ordering and API concepts; check your installed keyword reference and replace the explanatory promise, wait, and save calls with the corresponding version-specific keywords.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
*** Settings ***
Library    Browser
Library    OperatingSystem

*** Variables ***
${REPORT_URL}    https://example.test/reports
${PDF_NAME}      report.pdf

*** Test Cases ***
Save A Downloaded PDF
    New Browser    chromium    headless=True
    New Context    acceptDownloads=True
    New Page       ${REPORT_URL}
    ${download_promise}=    Promise To Wait For Download
    Click          text=Download report
    ${download}=            Wait For    ${download_promise}
    ${path}=                Save Download    ${download}    ${OUTPUT_DIR}${/}${PDF_NAME}
    File Should Exist       ${path}
    ${size}=                Get File Size   ${path}
    Should Be True          ${size} > 0
    [Teardown]    Close Browser

The promise must be created before the click. If it is created afterward, a fast response can be missed. Use a deterministic filename under Robot Framework’s output directory (or an explicitly created artifact directory), and retain the returned path for later assertions.

Rank #2
MobiPDF Lifetime - Professional PDF Editor for Windows | Edit, Sign & Convert PDFs | Best Adobe Acrobat Pro Alternative | Lifetime License
  • Edit PDFs with Ease. Modify text, images, and layouts directly within your PDF documents.
  • Convert & Organize. Export PDFs to Word, Excel, or ePub, and organize files with ease.
  • Read & Annotate. Enjoy intuitive reading modes and powerful tools to comment, highlight, and mark up PDFs.
  • Create & Manage PDFs. Create new PDFs, combine multiple files, scan documents, and compress for easy sharing.
  • Fill & Sign Forms. Complete forms and digitally sign documents with secure e-signature tools.

What to verify beyond existence

  • Check that the file exists and has a non-zero size.
  • Check the extension or content type expected by your application.
  • For stronger validation, read the first bytes in a separate test utility and confirm the PDF signature is present, while recognizing that a signature check does not prove the document is complete.
  • Preserve the artifact before closing the context, especially in teardown code that deletes temporary directories.

Common download variations

A click may open a new page and then start a download, submit a form, or require a prior login. In all cases, establish the download wait before the action that ultimately causes the response. If the endpoint requires authentication, create the context with the required login state or perform the login in that same context.

Handle an inline PDF response

An inline response normally has a PDF content type and a disposition that tells the browser to display it. Browser Library documentation reviewed for this article does not establish a built-in, version-independent keyword that extracts and saves the raw response bytes from that viewer navigation.

Do not use page printing as a substitute

Save Page As Pdf and Playwright’s page.pdf() generate a new PDF from rendered page content. They do not save the server response that supplied an inline PDF. Printing can capture the browser viewer UI, an empty page, or a representation with altered pagination.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use an authenticated HTTP request when bytes are required

If the test’s purpose is to validate the actual response body, call the PDF endpoint with an HTTP or API client and carry over the authentication required by the application. Browser contexts isolate cookies and storage, so a separately created client will need an access token, session cookie, or other supported credential. Verify your installed Browser Library and Playwright versions for any response-body API before writing version-specific code; the documented material does not settle one canonical Browser Library keyword for this case.

Rank #3
Adobe Acrobat Pro | PDF Software | Convert, Edit, E-Sign, Protect | PC/Mac Online Code | Activation Required
  • Create and edit PDFs. Collaborate with ease. E-sign documents and collect signatures. Get everything done in one app, wherever you go.
  • Edit text and images without jumping to another app.
  • E-sign documents or request e-signatures on any device. Recipients don’t need to log in to e-sign.
  • Convert PDFs to editable Microsoft Word, Excel, or PowerPoint documents.
  • Share PDFs for collaboration. Commenting features make it easy for reviewers to comment, mark up, and annotate.

When browser-level verification is enough

If you only need to prove that navigation reaches the PDF endpoint, assert the URL, response status where your version exposes it, and visible viewer state. Keep byte-level checks in the HTTP/API layer rather than pretending that a print operation is the original file.

Generate a PDF from rendered HTML with Save Page As Pdf

Use this path when the desired artifact is a print of the current page. Browser Library’s Save Page As Pdf is documented for Chromium while running headless. It returns the output path, and a relative path resolves under ${OUTPUT_DIR}.

*** Settings ***
Library    Browser

*** Test Cases ***
Print Rendered Report
    New Browser    chromium    headless=True
    New Page       https://example.test/report
    Save Page As Pdf    report-print.pdf
    [Teardown]    Close Browser

Playwright PDF generation uses print CSS by default. If the site’s screen styles are the intended appearance, switch the page to screen media before generating the PDF using the media-emulation API available in your Browser Library version.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Important print options

  • Path: choose a stable artifact location; relative paths use Robot’s output directory.
  • Format or dimensions: select a paper format or explicit width and height.
  • Margins and orientation: control printable space and portrait or landscape layout.
  • Background graphics: enable them when colored panels or backgrounds are part of the required output; the documented default is false.
  • Page ranges: export only selected pages when supported.
  • Scale: use a value from 0.1 through 2.
  • Headers and footers: configure them only when the generated printout needs them.
  • Tagged output: the documented default is false; enable it only when your accessibility or downstream-processing requirements call for it.
  • CSS page sizing: allow the page’s CSS page size to influence output when that is more important than the selected paper format.

These options affect a newly rendered printout, never the bytes returned by a PDF endpoint.

Rank #4
PDF Extra Lifetime - Professional PDF Editor - Best Adobe Acrobat Pro Alternative - Lifetime License for Windows PC
  • Perfect Adobe Acrobat Pro alternative – lifetime license for Windows 10 and 11.
  • EDIT text, images, pages, hyperlinks, designs in PDF documents. ORGANIZE PDFs.
  • READ and Comment on PDFs – Intuitive reading modes & document commenting and mark up tools!
  • CREATE, COMBINE, SCAN and COMPRESS PDFs.
  • FILL forms & Digitally Sign PDFs. Work with Digital certificates

Choose the right method

Case Saved file represents Documented path Constraint
Browser download The server-delivered downloaded file Wait for the download event, then save it Persist it before the owning context closes
Inline PDF navigation The server PDF displayed in the browser Use a version-verified response-body API or an appropriate HTTP/API client No Browser Library raw-response save keyword is established by the reviewed documentation
Page print A new PDF of rendered HTML Save Page As Pdf or Playwright page.pdf() Browser Library documents Chromium headless support; print CSS is used by default
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot failures systematically

No download event arrives

  • Cause: the wait was registered after the click. Fix: create the wait first.
  • Cause: the action opens an inline viewer instead. Fix: inspect the response behavior and use the inline-PDF approach.
  • Cause: a validation error prevents submission. Fix: assert the form state and network result before diagnosing downloads.

The saved path disappears

The browser context was closed before the file was persisted, or cleanup removed the temporary directory. Save to a permanent artifact path while the context remains open.

The file is empty or not a PDF

Authentication may have expired, the endpoint may have returned an HTML error page, or a bot check may have intercepted the request. Check status and content type through your HTTP layer, preserve the authenticated session, and record the response for diagnosis.

Save Page As Pdf fails

Confirm that Chromium is running headless and that the Browser Library version supports the keyword. Ensure the page has finished rendering, then check path permissions and the output directory.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The printout looks different from the screen

That is usually print CSS behavior. Emulate screen media when appropriate, wait for fonts and images, enable background graphics if required, and adjust margins, scale, or page size.

Best Value
PDF Pro 3 - PDF editor to create, edit, convert and merge PDFs - 100% Compatible with Adobe Acrobat - for Windows 11, 10, 8.1, 7
  • ALL-IN-ONE SOLUTION – read, edit, convert, merge and protect your PDF files
  • MAXIMUM FUNCIONALITY – create interactive forms, compare PDFs, bates numbering, find and replace text or colors, convert documents, OCR engine, comment, highlight, fill out and print forms, document protection and others
  • EASY TO INSTALL AND USE – well-structured user-interface, in-program instructions, free tech support whenever you need it
  • GREAT VALUE FOR MONEY - why spend a fortune if you can have maximum functionality at a reasonable price - this also fits the requirements of companies very well

Performance, reliability, and artifact hygiene

  • Reuse a browser when many tests run, but isolate contexts when cookies or downloads must not leak between tests.
  • Wait for the application’s meaningful readiness condition rather than an arbitrary short delay.
  • Use unique artifact names in parallel execution to avoid collisions.
  • Keep downloaded PDFs as CI artifacts only when they contain safe test data; redact or delete sensitive documents according to your retention policy.
  • For inline PDFs, separate browser navigation checks from API byte validation so failures identify the broken layer.

Or skip the browser setup

If your goal is simply a clean screenshot or PDF of a URL rather than testing the browser download lifecycle, ScreenshotNeo provides a single request. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo documentation for PDF and capture options. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Start with a free ScreenshotNeo account.

Frequently Asked Questions

Does Save Page As Pdf download a PDF linked with Content-Disposition?

No. It prints the currently rendered page. A Content-Disposition download requires the download-event workflow.

Can I keep a Playwright temporary download path for a later test?

No. Save the download to your own path before its browser context closes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Which browser supports Browser Library’s PDF page-saving keyword?

The documented Browser Library reference supports it in Chromium while headless.

How should I test an inline PDF’s exact bytes?

Use a version-verified response-body mechanism or an authenticated HTTP/API client, rather than printing the browser viewer.

The Bottom Line

Subscribe before triggering a real download and save it immediately. Treat inline PDFs as response bodies, and use Save Page As Pdf only when a print of rendered HTML is the intended artifact.

Quick Recap

Bestseller No. 1
PDF Extra 2024| Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Lifetime License | 1 Windows PC | 1 User [PC Online code]
PDF Extra 2024| Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Lifetime License | 1 Windows PC | 1 User [PC Online code]
READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.; CREATE, COMBINE, SCAN and COMPRESS PDFs
$99.99
Bestseller No. 2
MobiPDF Lifetime - Professional PDF Editor for Windows | Edit, Sign & Convert PDFs | Best Adobe Acrobat Pro Alternative | Lifetime License
MobiPDF Lifetime - Professional PDF Editor for Windows | Edit, Sign & Convert PDFs | Best Adobe Acrobat Pro Alternative | Lifetime License
Edit PDFs with Ease. Modify text, images, and layouts directly within your PDF documents.; Convert & Organize. Export PDFs to Word, Excel, or ePub, and organize files with ease.
$99.99
Bestseller No. 3
Adobe Acrobat Pro | PDF Software | Convert, Edit, E-Sign, Protect | PC/Mac Online Code | Activation Required
Adobe Acrobat Pro | PDF Software | Convert, Edit, E-Sign, Protect | PC/Mac Online Code | Activation Required
Edit text and images without jumping to another app.; Convert PDFs to editable Microsoft Word, Excel, or PowerPoint documents.
$239.88
Bestseller No. 4
PDF Extra Lifetime - Professional PDF Editor - Best Adobe Acrobat Pro Alternative - Lifetime License for Windows PC
PDF Extra Lifetime - Professional PDF Editor - Best Adobe Acrobat Pro Alternative - Lifetime License for Windows PC
Perfect Adobe Acrobat Pro alternative – lifetime license for Windows 10 and 11.; EDIT text, images, pages, hyperlinks, designs in PDF documents. ORGANIZE PDFs.
$99.99
Bestseller No. 5
PDF Pro 3 - PDF editor to create, edit, convert and merge PDFs - 100% Compatible with Adobe Acrobat - for Windows 11, 10, 8.1, 7
PDF Pro 3 - PDF editor to create, edit, convert and merge PDFs - 100% Compatible with Adobe Acrobat - for Windows 11, 10, 8.1, 7
ALL-IN-ONE SOLUTION – read, edit, convert, merge and protect your PDF files
$29.99

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.