


Options.addPreference("", "") // Set your default download directory's path Options.addPreference("", 2) //Last downloaded folder Options.addPreference("",2) įirefoxOptions options = new FirefoxOptions() //For setting up options for FirefoxĭesiredCapabilities firefoxDesiredCapabilities = new DesiredCapabilities() //Initializing desired capabilities To download to another folder: FirefoxOptions options = new FirefoxOptions() To download to desktop, change the value in 2nd line to 0: FirefoxOptions options = new FirefoxOptions() Options.addPreference("", "application/octet-stream") To download to folder Downloads: FirefoxOptions options = new FirefoxOptions() mentioned above.įor me, download csv file and found that Content-Type = "application/octet-stream"
#Java for firefox download driver
WebDriver driver = new FirefoxDriver(options) ĭriver.findElement(By.linkText("IRS Form 872-C")).click()
#Java for firefox download pdf
tPreference("pdfjs.disabled", true) // disable the built-in PDF viewer tPreference("", "application/pdf text/plain application/text text/xml application/xml") Then to download a PDF with Firefox: FirefoxOptions options = new FirefoxOptions()
