2

I am trying to automate a script in c# selenium which downloads an excel file in chrome browser.Then I need to open the downloaded file to verify data.I cannot use the default local downloaded path of my computer as the download path might change in other systems.Can any one one tell me how to get the chrome download folder path in c# selenium.

Thanks, Sharmila

Sharmila Kumari
  • 81
  • 1
  • 3
  • 6
  • 1
    Possible duplicate of [Download file at custom path using Selenium WebDriver](http://stackoverflow.com/questions/33434443/download-file-at-custom-path-using-selenium-webdriver) – M. Adeel Khalid Feb 13 '17 at 04:49
  • 2
    Thank u but I do not want to change the download path. I want to get the existing download path in chrome – Sharmila Kumari Feb 13 '17 at 10:58
  • I believe the answer you're looking for is here: https://stackoverflow.com/questions/18437816/how-to-find-chrome-download-path-in-java – Michiel Bugher Oct 02 '17 at 15:02

1 Answers1

3

You can get the Downloads path as follow:

    string pathUser = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
    string pathDownload = Path.Combine(pathUser, "Downloads");
M. Adeel Khalid
  • 1,786
  • 2
  • 21
  • 24
  • This is a Windows setting that Chrome uses as default, but can be changed in Chrome (i.e. Chrome download folder may be different from "Windows" download folder) – Gian Paolo Feb 13 '17 at 12:13
  • 1
    Yes but i think the selenium webdriver for chrome will use default settings that's why I posted this. – M. Adeel Khalid Feb 13 '17 at 12:15