Uploaded November 2022 | Updated September 2026, 2 weeks ago
For Web Browser Automation I'm finally switching from Puppeteer (technically pyppeteer) to Microsoft Playwright. One of the strange things though is that even with accept_downloads (aka acceptDownloads) set to True and launch_persistent_context mode, any download links that you click which end up in your downloads directory are automatically deleted when the Playwright browser context that created it closes.
There's an official solution to this and I'll be researching it. It has to do with an official downloads https://playwright.dev/docs/api/class-download object but at first glance it looks too close to NodeJS for the Pythonic interface Playwright provides. In other words it wasn't immediately obvious how to do it under Python, so I just wrote a bash script to snag the temporary files before they disappeared and thought I'd share it.
For Web Browser Automation I'm finally switching from Puppeteer (technically pyppeteer) to Microsoft Playwright. One of the strange things though is that even with accept_downloads (aka acceptDownloads) set to True and launch_persistent_context mode, any download links that you click which end up in your downloads directory are automatically deleted when the Playwright browser context that created it closes.
There's an official solution to this and I'll be researching it. It has to do with an official downloads https://playwright.dev/docs/api/class-download object but at first glance it looks too close to NodeJS for the Pythonic interface Playwright provides. In other words it wasn't immediately obvious how to do it under Python, so I just wrote a bash script to snag the temporary files before they disappeared and thought I'd share it.










