module Capybara::Selenium::Driver::ChromeDriver

def resize_window_to(handle, width, height)

def resize_window_to(handle, width, height)
  super
rescue Selenium::WebDriver::Error::UnknownError => e
  raise unless e.message.include?('failed to change window state')
  # Chromedriver doesn't wait long enough for state to change when coming out of fullscreen
  # and raises unnecessary error. Wait a bit and try again.
  sleep 0.25
  super
end