Downloading File and saving to KV Store - Selenium Python

Hello, I am trying to download a file (Excel) from a website and want to save it to the KV Store. The problem is that on clicking the download button, I cannot see where the file was downloaded. How can I achieve this? Thank you!
4 Replies
flat-fuchsia
flat-fuchsia10mo ago
Hi @jb17_user, depending if you use playwright or puppeteer I would recommend you to checkout these two articles explaining what you might be trying to achieve https://playwright.dev/docs/downloads https://docs.apify.com/academy/puppeteer-playwright/common-use-cases/downloading-files
Downloading files | Academy | Apify Documentation
Learn how to automatically download and save files to the disk using two of the most popular web automation libraries, Puppeteer and Playwright.
diplomatic-chocolate
diplomatic-chocolateOP10mo ago
Thanks @Lukas Celnar but I am using Selenium currently.
flat-fuchsia
flat-fuchsia10mo ago
Oh i see. In that case i found this great article https://www.browserstack.com/guide/download-file-using-selenium-python
BrowserStack
How to download file using Selenium & Python | BrowserStack
Step-by-step tutorial on how to download a file from a website using Selenium and Python. Also, learn how to download files to a specific folder using Selenium.
diplomatic-chocolate
diplomatic-chocolateOP10mo ago
Hello @Lukas Celnar, I already had that piece of code with prefs and download.default_directory but that still does not save the file to the directory I mentioned. Also, I checked the path via os.listdir() but it does not list the downloaded file. Can you please help me with this? Could it be because of the Docker volume?

Did you find this page helpful?