selenium-python Downloading file Error -- Failed -Download Error

+1 vote

I am trying to download files in the selected directory other than the default directory.

 I am getting "Failed -Download Error". 

please help me resolve this. Below is my code.

chrome_options = webdriver.ChromeOptions()
prefs = {"download.default_directory": "C:/Users/xxxx/PycharmProjects//","download.prompt_for_download": False, "download.directory_upgrade": True, "safebrowsing.enabled":True}
chrome_options.add_experimental_option("prefs",prefs)
driver = webdriver.Chrome(executable_path="../Drivers/chromedriver.exe", chrome_options=chrome_options)
driver.get("URL")
Sep 7, 2020 in Selenium by MINU
• 130 points
5,381 views

1 answer to this question.

0 votes

The path you declared for the default directory is invalid. Either escape the backslashes or provide a literal string.

options = webdriver.ChromeOptions()
options.add_experimental_option("prefs", {
  "download.default_directory": r"C:\Users\xxx\downloads\PycharmProjects",
  "download.prompt_for_download": False,
  "download.directory_upgrade": True,
  "safebrowsing.enabled": True
})
driver = webdriver.Chrome(chrome_options=options)
answered Sep 7, 2020 by Sirajul
• 59,230 points

Related Questions In Selenium

0 votes
1 answer

Headless ChromeDriver using Python Selenium error: Fails To Start— “DevTools request failed”

This should be because your ChromeDriver is ...READ MORE

answered Mar 30, 2018 in Selenium by nsv999
• 5,500 points
1,655 views
0 votes
1 answer
0 votes
1 answer

Unable to Start tor using Python Selenium Error: failed to start

I tried to solve same problem on ...READ MORE

answered Jun 29, 2018 in Selenium by Samarpit
• 5,910 points
3,552 views
+1 vote
1 answer
0 votes
1 answer

Installing Selenium Webdriver with Python package

Hey Hemant, for installing Selenium Webdriver with ...READ MORE

answered May 8, 2019 in Selenium by Anvi
• 14,150 points
15,208 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
12,751 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
8,622 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
6,697 views
0 votes
1 answer

How do you automatically download a Pdf with Selenium Webdriver in Python.

Try this code, from selenium import webdriver download_dir = ...READ MORE

answered Mar 5, 2020 in Selenium by Sirajul
• 59,230 points
26,613 views
+1 vote
3 answers

Error occurred during initialization of boot layer java.lang.module.FindException: Module Selenium not found

This might probably be coz while creating ...READ MORE

answered Nov 27, 2019 in Selenium by Sirajul
• 59,230 points
58,384 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP