Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

I'm trying to use FireFox's built-in javascript PDF viewer with WebDriver so I can access the DOM of a PDF. However, FireFox has an Adobe plugin which takes over and displays the PDF. Whatever preferences I set in about:config don't help. I've tried various preferences, like:

    profile.SetPreference("browser.helperApps.neverAsk.saveToDisk","application/pdf,application/zip");
profile.SetPreference("plugin.disable_full_page_plugin_for_types","application/pdf");
profile.SetPreference("extensions.autoDisableScopes", 0);
profile.SetPreference("pdfjs.disabled", false);
profile.SetPreference("pdfjs.firstRun", false);

But whatever combination I use either kills the Adobe plugin and pdfjs or gives me a popup asking where to save the PDF. If I manually disable the Adobe plugin, the javascript viewer takes over

How can I disable the Adobe plugin, but keep FireFox's javascript PDF enabled and access the DOM of the PDF?

share|improve this question
    
Is it an option to uninstall the adobe plugin? –  vincebowdren Aug 9 '13 at 15:28
    
Frustratingly, no. –  Lord Kinboat Aug 12 '13 at 10:53
add comment

1 Answer 1

This worked for me (think setting 'pdfjs.migrationVersion' did the trick)

FirefoxProfile desiredCapabilities = new FirefoxProfile();      
desiredCapabilities.setPreference(
"browser.helperApps.neverAsk.saveToDisk",
    "application/x-zip-compressed,application/zip,text/csv,text/CSV,application/octet-stream,application/pdf"); 
desiredCapabilities.setPreference("plugin.disable_full_page_plugin_for_types", "application/pdf");
desiredCapabilities.setPreference("browser.download.folderList", 2); 
desiredCapabilities.setPreference("pdfjs.disabled", false); 
desiredCapabilities.setPreference("pdfjs.firstRun", false); 
desiredCapabilities.setPreference("pdfjs.migrationVersion", 1);

WebDriver driver = new FirefoxDriver(desiredCapabilities);
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.