class ActionDispatch::SystemTesting::Driver

def initialize(driver_type, **options, &capabilities)

def initialize(driver_type, **options, &capabilities)
  @driver_type = driver_type
  @screen_size = options[:screen_size]
  @options = options[:options] || {}
  @name = @options.delete(:name) || driver_type
  @capabilities = capabilities
  if [:poltergeist, :webkit].include?(driver_type)
    ActiveSupport::Deprecation.warn <<~MSG.squish
      Poltergeist and capybara-webkit are not maintained already.
      Driver registration of :poltergeist or :webkit is deprecated and will be removed in Rails 7.1.
      You can still use :selenium, and also :cuprite is available for alternative to Poltergeist.
    MSG
  end
  if driver_type == :selenium
    gem "selenium-webdriver", ">= 4.0.0"
    require "selenium/webdriver"
    @browser = Browser.new(options[:using])
    @browser.preload
  else
    @browser = nil
  end
end