Skip to content

Instantly share code, notes, and snippets.

@blafri
blafri / selenium_hack.rb
Last active November 7, 2025 15:23
Hack to fix browser size issues with the current version of chrome driver that is not respecting the screen_size option.
# There is a bug with the chrome driver that does not respect the screen_size option, so we have this hack
# to resize the window to the proper size after it visits a page.
#
# This should be removed in the future once the bug is fixed.
#
# See: https://github.com/SeleniumHQ/selenium/issues/15827
def visit(...)
super.tap do
page.driver.browser.manage.window.resize_to(1400, 800)
end