Skip to content

fix(page): leave the window size to Chrome when window_size is nil - #339

Merged
route merged 2 commits into
mainfrom
window-size-nil
Oct 15, 2026
Merged

route merged 2 commits into
mainfrom
window-size-nil

Conversation

@route

@route route commented Oct 15, 2026

Copy link
Copy Markdown
Member

Closes #278.

window_size: nil made Cuprite raise Ferrum::BrowserError: Invalid parameters on every page. Ferrum already leaves out --window-size when the size is nil, but Page#prepare_page always called resize(width: nil, height: nil), and Chrome rejects Browser.setWindowBounds without a size.

Now Cuprite resizes only when a size is set. Otherwise it applies just the viewport settings, so mobile: and scale_factor: still work. Chrome keeps its own window size, which makes start-maximized usable:

Capybara::Cuprite::Driver.new(app, headless: false, window_size: nil, browser_options: { "start-maximized" => nil })

Verified in headful Chrome on a 2560×1440 screen: with start-maximized alone the window stays 1024×768 (normal), while with window_size: nil it opens at 2560×1410 (maximized).

@route
route merged commit 535dff5 into main Oct 15, 2026
7 checks passed
@route
route deleted the window-size-nil branch October 15, 2026 19:51
@route route mentioned this pull request Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't maximize window

1 participant