Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to automate file download functionality through selenium webdriver?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 278
    Comment on it

    File download functionality can be automated by setting the browser's preferences. We set the directory in which the file will be downloaded.

    FirefoxProfile profile = new FirefoxProfile();
    profile.setPreference("browser.download.dir", "E:\\Automation");
    profile.setPreference("browser.download.folderList", 2);
    //0 for Desktop, 1 for default location and 2 for Custom location
    profile.setPreference("browser.helperApps.neverAsk.saveToDisk","application/zip");
    
    WebDriver driver = new FirefoxDriver(profile);
    driver.get("http://docs.seleniumhq.org/download/");
    driver.findElement(By.xpath("//*[@id='mainContent']//a[text()='Download' and contains(@href,'selenium-java-2.46.0.zip')]")).click();
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: