This post objective is to illustrate how to use Selenium from Firefox Browser.
Java code snippet is here:
Java code snippet is here:
@Test public void testDownload() throws Exception { WebDriver driver = new FirefoxDriver(FirefoxDriverProfile()); driver.manage().window().maximize(); driver.get("http://seleniumhq.org"); Thread.sleep(5000); driver.findElement(By.linkText("Download")).click(); Thread.sleep(5000); driver.findElement(By.linkText("2.46.0")).click(); Thread.sleep(5000); } public static FirefoxProfile FirefoxDriverProfile() { FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("browser.download.folderlist", 2); profile.setPreference("browser.download.manager.showWhenStarting",false); profile.setPreference("browser.download.dir", "E:\\sari\\os"); profile.setPreference("browser.helperApps.neverAsk.openFile","text/csv,application/x-msexcel,application/excel,application/x-excel,application/vnd.ms-excel,image/png,image/jpeg,text/html,text/plain,application/msword,application/xml,application/java-archive"); profile.setPreference("browser.helperApps.neverAsk.saveToDisk","text/csv,application/x-msexcel,application/excel,application/x-excel,application/vnd.ms-excel,image/png,image/jpeg,text/html,text/plain,application/msword,application/xml,application/java-archive"); profile.setPreference("browser.helperApps.alwaysAsk.force", false); profile.setPreference("browser.download.manager.alertOnEXEOpen", false); profile.setPreference("browser.download.manager.focusWhenStarting",false); profile.setPreference("browser.download.manager.useWindow", false); profile.setPreference("browser.download.manager.showAlertOnComplete",false); profile.setPreference("browser.download.manager.closeWhenDone", false); return profile; }