I'm writing a test that I'd like to headless, which will also download a file within java using Selenium. from here I learn that you can set a driver to be headless by throwing this code before you initialize the driver:
options.setHeadless(true); //sets driver to work headless
WebDriver driver = new FirefoxDriver(options);
and that I can use this method to write a Firefox Profile which will dictate a download directory and allow me to download a file with firefox w/o any pop up windows (I've modified the method to allow the method to permit the download location as an argument). After creating the method, I call it within main like this:
downloadPath = "C:\Scripts"
WebDriver driver = new FirefoxDriver(FirefoxDriverProfile(downloadPath));
and then say I want to use the following code with either of the two methods above:
driver.get(https://github.com/mozilla/geckodriver/releases);
driver.findElement(By.linkText("geckodriver-v0.27.0-win64.zip")).click();
I'll either not have a headless version of firefox running, or I get a pop up save prompt when I go to download the zip file.
How can I combine these two funcitons, the profile and the options?
edit: fixed the setHeadless(false)
to be setHedless(true)