How accept alert download in firefox?

i’ve used
WebDriver driver= DriverFactory.getWebDriver();

but not have success

You cannot interact with the download window because the browser use native dialog which cannot be controlled with the webdriver.

My easy fix is to set browser default behaviour to download to automatically. When you click the link, it will download to a predefined directory.