Trying to install extension from Chrome store through Capybara

Trying to install Chrome extension through capybara test, but unable to achieve in Ruby

https://chrome.google.com/webstore/detail/google-keep-chrome-extens/lpcaedmchfhocbbapmcbpinfpgnhiddi

Capybara, Chrome Headless: File Download is not working

I am trying to download a file with chrome headless.
My Chrome version is 67.0.3396.87 and my chromedriver has the 2.4.

The file does not appear on my file system. As far as i researched, its a safety function of chrome headless to prevent file downloads, but which can be turned on again.

Thats what i tried to do, regarding to this Thread:
https://bugs.chromium.org/p/chromium/issues/detail?id=696481

Still nothing works. I tried different approaches with

Page.setDownloadBehavior

eg. i copied the content of comment 78 but Chrome does not respond to it, or atleast it still does not work:

def enable_chrome_headless_downloads(driver, directory)
  bridge = driver.send(:bridge)
  path = '/session/:session_id/chromium/send_command'
  path[':session_id'] = bridge.session_id
  bridge.http.call(:post, path, {
    "cmd" => "Page.setDownloadBehavior",
    "params" => {
      "behavior" => "allow",
      "downloadPath" => directory,
    }
  })
end

I also checked if i could download manually a file with headless chrome with

'--remote-debugging-port=9222'

but it was not possible either.
Has anyone an idea, what I could do to make it work?

Thanks already!

setting chrome ‘devtools.open_docked’ to false in selenium webdriver

I am want the chrome devtools to open detached from the window when using selenium with capybara.

Currently devtools is attached to the right side (default.)

I am using the following code:

Capybara.register_driver :chrome do |app|
  capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
    chromeOptions: { 
      args: %w[auto-open-devtools-for-tabs], # <- this works!
      prefs: {'devtools.open_docked' => false} # <- has no effect!
      # also tried {devtools: {open_docked: false}}
      }
  )
  Capybara::Selenium::Driver.new(
    app, browser: :chrome, desired_capabilities: capabilities
  )
end