1

I used profile["permissions.default.image"] = 2 earlier but now it doesn't work for me:

require "capybara/rspec"
require "selenium/webdriver"

Capybara.register_driver :my_driver do |app|
  profile = Selenium::WebDriver::Firefox::Profile.new
  profile["permissions.default.image"] = 2
  desired_capabilities = Selenium::WebDriver::Remote::Capabilities.firefox firefor_profile: profile
  Capybara::Selenium::Driver.new(app,
    desired_capabilities: desired_capabilities,
    browser: :firefox,
  )
end
Capybara.default_driver = :my_driver


feature do
  scenario do
    visit "http://lenta.ru"
    STDIN.gets
  end
end

I still see images.

$ /Applications/Firefox.app/Contents/MacOS/firefox-bin -v
Mozilla Firefox 38.3.0

gem "selenium-webdriver", "2.48.0"
Nakilon
  • 34,866
  • 14
  • 107
  • 142
  • 1
    It seems that it's no longer possible to define this preference: http://stackoverflow.com/questions/31571726/cant-turn-off-images-in-selenium-firefox/31572457#31572457 – Florent B. Apr 29 '16 at 19:59
  • @FlorentB. damn, I hoped it's smth fundamentally wrong in my code so it could explain why I can't make another option to work (supressing Download dialog), that I can't ask properly on SO because it's impossible to reproduce without accessing specific website my company is working on. – Nakilon Apr 29 '16 at 21:37
  • _Impossible to reproduce_ means it uses 'ng-grid' Angular plugin to create and download file dynamically (not through the network), that is not so trivial thing to debug or find detailed success story about that. – Nakilon Apr 29 '16 at 21:47
  • Resolved that issue about downloading -- content-type from grid-ui plugin was application/octet-stream and Capybara::Selenium::Driver constructor had to get :profile instead of :desired_capabilities. – Nakilon May 04 '16 at 12:48
  • @FlorentB. since noone else came here to answer, you may make an answer from your comment so I could accept it. – Nakilon Aug 08 '16 at 04:19

0 Answers0