Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium firefox profile not being set correctly

I have the following code snippet. I want pdf files to be automatically saved to the directory.

profile = Selenium::WebDriver::Firefox::Profile.new
profile['browser.download.dir'] = "//Users/mmuenster/www/pc_interface/pdf_downloads"
profile['browser.download.folderList'] = 2
profile['browser.helperApps.neverAsk.saveToDisk'] = 'application/pdf'

driver = Selenium::WebDriver.for :firefox, :profile => profile
driver.manage.window.maximize

However, though the "about:config" in Firefox shows this option being set, when I got to preferences and applications in Firefox, pdfs are set to "Preview in Firefox".

Any ideas what is wrong?

Thanks

like image 663
user1077851 Avatar asked Jan 29 '26 19:01

user1077851


1 Answers

I discovered the problem. I upgraded to Firefox 19 which has the pdfjs add-on built in. The solution was to add the following

profile['pdfjs.disabled'] = true

This worked!

like image 169
user1077851 Avatar answered Feb 01 '26 12:02

user1077851



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!