[Python] Couldn't download using selenium Chromedriver

Discussão em 'Python' iniciado por Stack, Março 6, 2025.

  1. Stack

    Stack Membro Participativo

    Im trying to change the download directory in chrome using prefs method, though the directory changes, download fails stating an error.This is the below code Ive used in python.

    chrome_options = webdriver.ChromeOptions()
    chrome_options.add_argument("--disable-notifications")
    chrome_options.add_argument("--start-maximized")
    prefs = {'download.default_directory': selected_folder,
    'savefile.default_directory': selected_folder
    }
    chrome_options.add_experimental_option('prefs', prefs)
    chrome_options.add_argument("--enable-logging")
    driver = webdriver.Chrome(service=service,options=chrome_options)


    Actually it clicks a button to download from chrome set using find element by id.

    I tried the above code, but the download fails

    Continue reading...

Compartilhe esta Página