Can not download a file with python selenium and chromedriver on linux OS

Viewed 659

I am trying to download a file using Selenium with chromedriver and python3. My code works perfectly with Windows OS, but when I try to execute the same code on amazon EC2, everythings fine, no erros, all elements are found but no file downloaded in the specific directory? I am using the code below, any idea ?

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()  

prefs = {"download.default_directory" : '/my_directory/'}
chrome_options.add_experimental_option("prefs",prefs)
chrome_options.add_argument('--headless')
browser= webdriver.Chrome(options=chrome_options)
1 Answers

I know this does not quite answer your question, but try taking a look at: https://github.com/21buttons/pychromeless#downloading-files

I ran into the same issue you are having, and never solved it. But since my task is going to be run weekly, I decided on using AWS Lambda and found this solution. I hope this helps in your quest!

Related