rubycdp / ferrum

Headless Chrome Ruby API
https://ferrum.rubycdp.com
MIT License
1.7k stars 122 forks source link

Question about disabling plugin/extension #336

Closed zsan closed 1 year ago

zsan commented 1 year ago

Hello,

Just for my curiosity, is that possible to disable plugin with Ferrum or CDP ?

For example, i have this code with capybara to disable PDF Viewer

Capybara.register_driver :chrome do |app|
  Capybara::Selenium::Driver.load_selenium

  browser_options = Selenium::WebDriver::Chrome::Options.new

  browser_options.add_preference(
    :download,
    directory_upgrade: true,
    prompt_for_download: false,
    extensions_to_open: "applications/pdf"    
  )

  browser_options.add_preference(
    :plugins,
    always_open_pdf_externally: true,
    plugins_disabled: ["Chrome PDF Viewer"]    
  )

  Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
end
route commented 1 year ago

If you have a question, please open discussion, not an issue