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
895 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
• 58,990 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 29, 2018 in Selenium by nsv999
• 5,520 points
857 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,890 points
2,306 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,130 points
5,221 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,520 points
4,656 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,010 points
5,491 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,890 points
3,320 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
• 58,990 points
9,430 views
+2 votes
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
• 58,990 points
23,334 views