0
I am automating the download of a file .xlsx of a website with Selenium with the FirefoxDriver but I can’t interact in the download pop-up of the site!
There’s how I interact with the pop-up by checking Save file and upload to a folder?
I’m using the following code to interfere with the pop-up:
IWebDriver driver = new FirefoxDriver();
driver.Url = "";
driver.Manage().Window.Maximize();
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30);
driver.FindElement(By.XPath("//button[@class='jss174']")).Click();
Thread.Sleep(6000);
driver.FindElement(By.XPath("//input[@class='jss314']")).Click();
Thread.Sleep(6000);
driver.FindElement(By.XPath("//img[@src='a95fbd8f692090fb308a787688c0373f.png']")).Click();
FirefoxProfile profile = new FirefoxProfile();
profile.AcceptUntrustedCertificates = true;
profile.SetPreference("browser.download.folderList", 2);
profile.SetPreference("browser.download.dir", "c:\\mydownloads");
//profile.SetPreference("network.http.phishy-userpass-length", 255);
profile.SetPreference("browser.download.manager.showWhenStarting", false);
profile.SetPreference("browser.helperApps.neverAsk.saveToDisk", "application/excel");
And I’m getting the following mistake:


You will not be able to do this with this window. Because it is Windows and Selenium is limited to the browser. You can try to create some
optionsto save to a specific directory– Tmilitino
@You can edit the browser options to download automatically in a directory. But when you reopen your browser with Firefoxdriver the settings won’t hold!
– Evandro
@Thanks for the tips! I switched the Webdriver to Chromedriver, and got the automatic download in the default Downloads folder!
– Evandro