First, use a new Firefox browser to open the Web app, the browser does not have any plug-ins, nor do any default configuration of the browser, but need to configure the browser properties
Get all the configuration files for a browser
Profilesini allprofiles = new Profilesini ();
"Selenium" is the profile created previously, with no plugins, and no default configuration for the browser
Firefoxprofile profile = Allprofiles.getprofile ("Selenium");
Set whether the Download progress box is displayed
Profile.setpreference ("Browser.download.manager.showWhenStarting", false);
Browser.download.folderList Set the default download folder for Firefox. 0 is desktop, 1 is "my download"; 2 is Custom
Profile.setpreference ("Browser.download.folderList", 2);
Set the browser's default download folder and path, and if you use a custom path, you must set Browser.download.folderList to 2
Profile.setpreference ("Browser.download.dir", "e:\\");
Set which type of file download does not ask for direct download
Profile.setpreference ("Browser.helperApps.neverAsk.saveToDisk",
"Application/zip,text/plain,application/vnd.ms-excel,text/csv,text/comma-separated-values,application/ octet-stream,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/ Vnd.openxmlformats-officedocument.wordprocessingml.document ");
Open a page with a new browser selenium
Webdriver Driver = new Firefoxdriver (profile);
Second, the use of plug-ins installed, the default configuration of the Firefox browser to open the Web app (that is, the browser itself is set to download the Windows dialog box does not pop up), completely do not need to do any configuration, only need to use the default browser to
Profilesini allprofiles = new Profilesini ();
"Selenium" is the profile created previously, with no plugins, and no default configuration for the browser
Firefoxprofile profile = Allprofiles.getprofile ("Default");
Browser Default to open page
Webdriver Driver = new Firefoxdriver (profile);
Webdriver implementation of the Download function, screen out the Windows Pop-up dialog box, Firefox settings browser properties, two ways to achieve: