Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98779

Selenium download file automatically c#

$
0
0

I'm try to setup Firefox in order to be auto-download files. I did how suggested in enter link description here, But I cannot get it to work.

This is my code:

FirefoxOptions options = new FirefoxOptions();
        options.SetPreference("browser.download.folderList", 2);
        options.SetPreference("browser.download.dir", "C:\\Windows\\temp");
        options.SetPreference("browser.download.useDownloadDir", true);
        options.SetPreference("browser.helperApps.neverAsk.saveToDisk", "application/pdf");
        options.SetPreference("pdfjs.disabled", true);  // disable the built-in PDF viewer
        options.SetPreference("browser.download.useDownloadDir", true);
        driver = new FirefoxDriver(options);
        driver.Manage().Window.Maximize();
        driver.Navigate().GoToUrl("https://www.mozilla.org/en-US/foundation/documents");
        driver.FindElement(By.LinkText("IRS Form 872-C")).Click();

The PDF is still opened in the browser PDF viewer. Any idea?


Viewing all articles
Browse latest Browse all 98779

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>