# Force Chromium to download PDFs

**URL:** <https://forum.robotframework.org/t/force-chromium-to-download-pdfs/6495>\
**Category:** Browser\
**Created:** [21 November 2023 07:19 UTC](https://forum.robotframework.org/t/force-chromium-to-download-pdfs/6495 "2023-11-21T07:19:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lowres](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/lowres/32/3140_2.png) [@Lowres](https://forum.robotframework.org/u/Lowres)\
**Post date:** [21 November 2023 07:19 UTC](https://forum.robotframework.org/t/force-chromium-to-download-pdfs/6495/1 "2023-11-21T07:19:32Z")

</div>

Hello,

I am in the process of rewriting Selenium Library to Browser Library and hit a challenge. The site I am testing creates a dynamically generated PDF. In Selenium with Firefox I disable showing PDF files in the browser which triggers the browser to download the PDF on which I later run a compare validation process on.

In the Browser Library I have not had any luck finding how to disable the PDF viewing and force the PDF to be downloaded in Chromium.

Any suggestions on how to achieve this?

Thanks for your help,  
Lowres.

---

<div class="post-metadata">

**Author:** ![falcon030](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/falcon030/32/3420_2.png) [@falcon030](https://forum.robotframework.org/u/falcon030)\
**Post date:** [21 November 2023 22:15 UTC](https://forum.robotframework.org/t/force-chromium-to-download-pdfs/6495/3 "2023-11-21T22:15:52Z")

</div>

There seems to be an issue with Playwright that causes this: [[Feature] Make PDF testing idiomatic · Issue #7822 · microsoft/playwright · GitHub](https://github.com/microsoft/playwright/issues/7822). There alse a Python workaround posted in this thread that you can perhaps use?

---

<div class="post-metadata">

**Author:** ![Lowres](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/lowres/32/3140_2.png) [@Lowres](https://forum.robotframework.org/u/Lowres)\
**Post date:** [5 December 2023 12:38 UTC](https://forum.robotframework.org/t/force-chromium-to-download-pdfs/6495/4 "2023-12-05T12:38:26Z")

</div>

Thanks Falcon030,

So worked it out in the end I found a button in the UI which triggers a download of the PDF(phew) I launch my browser with:

```python
New Persistent Context url=${CLOUDINSTANCEURL} browser=${BROWSER} headless=${HEADLESS} acceptDownloads=true

```

And the part in my script where the download happens is…

```
${dl_promise} Promise To Wait For Download ${DOWNLOADDIR}\\${PNLNAME}.pdf
Click //td[text()="Download as PDF"]
${file_obj}= Wait For ${dl_promise}

```
