I am doing automation using selenium with testng. I have ubuntu OS. I need to download a pdf file and verify its content. I click on a button, a new window opens whose content's view is like pdf. (What that kind of page is called ? I mean when I save it, its saved as pdf but its url is that of a web page). Then I click on download on the newly opened window and a pop-up comes. I want to know how to handle this ?

I searched about this and here is my code now:

```
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("browser.helperapps.neverAsk.saveToDisk" , "application/octet-stream;application/pdf"); 
profile.setPreference("browser.helperApps.alwaysAsk.force", false);
profile.setPreference("browser.download.manager.showWhenStarting",false);
        profile.setPreference("browser.download.folderList", 2); 
        profile.setPreference("browser.download.dir",System.getProperty("user.dir"));

driver =new FirefoxDriver(profile);

```

Thanks :)