0

When I set my desired_capabilities for Chrome as such

caps = {
  "chromeOptions" => {
    "prefs" => {
      :plugins => {
        :plugins_disabled => ["Chrome PDF Viewer"]
      },

      :download => {
        :prompt_for_download => false,
        :directory_upgrade   => true,
        :default_directory   => ENV['files_dir']
      }
    },

    "args" => ['--start-maximized']
  }
}

then query caps with caps['chromeOptions']['args'], the --start-maximized flag is lost - this is what is returned

caps['chromeOptions']['args']
=> []

What is the issue here?

Noffica
  • 469
  • 8
  • 23

1 Answers1

1

You should start with the chrome capabilities first:

caps = Selenium::WebDriver::Remote::Capabilities.chrome
caps.merge!(your_caps)
browser = Selenium::WebDriver.for :chrome, desired_capabilities: caps
Lucas Tierney
  • 2,503
  • 15
  • 13