When window-size and start-maximized parameters are passed to Chrome, window-size takes precedence.
With cuprite, there's no way not to pass window-size, thus no way to maximize the window.
The following code fails due to window_size: nil:
require 'capybara/cuprite'
require 'capybara/dsl'
class Browser
include Capybara::DSL
def run
Capybara.current_driver = :cuprite
Capybara.javascript_driver = :cuprite
Capybara.register_driver(:cuprite) do |app|
Capybara::Cuprite::Driver.new(app, headless: false, browser_options: { 'start-maximized' => nil }, window_size: nil)
end
visit 'https://example.com'
end
end
Browser.new.run
It might be a ferrum issue, but it seems to work correctly when invoked through ferrum
require 'ferrum'
browser = Ferrum::Browser.new(headless: false, browser_options: { 'start-maximized' => nil }, window_size: nil)
page = browser.create_page
page.go_to('http://example.com')
Possible solutions:
:window_size could accept a :maximized value in ferrum/cuprite, and it would add start-maximized to the browser options
:window_size could accept a nil value in ferrum/cuprite, so it could work with start-maximized
- Not pass the
:window_size parameter to chrome unless explicitly specified, but that is a minor breaking change
When
window-sizeandstart-maximizedparameters are passed to Chrome,window-sizetakes precedence.With cuprite, there's no way not to pass
window-size, thus no way to maximize the window.The following code fails due to
window_size: nil:It might be a ferrum issue, but it seems to work correctly when invoked through ferrum
Possible solutions:
:window_sizecould accept a:maximizedvalue in ferrum/cuprite, and it would addstart-maximizedto the browser options:window_sizecould accept anilvalue in ferrum/cuprite, so it could work withstart-maximized:window_sizeparameter to chrome unless explicitly specified, but that is a minor breaking change