class AutomationHelpers::Patches::SeleniumOptions

Public Class Methods

new(browser) click to toggle source
Calls superclass method
# File lib/automation_helpers/patches/selenium_options.rb, line 6
def initialize(browser)
  @browser = browser
  super()
end

Public Instance Methods

patch!() click to toggle source

@return [Nil || AutomationHelpers.logger.info]

For SeleniumOptions we only want to run the patch when we are on browsers without the relevant JSON fixes in upstream

Calls superclass method AutomationHelpers::Patches::Base#patch!
# File lib/automation_helpers/patches/selenium_options.rb, line 15
def patch!
  return unless valid?

  super
end

Private Instance Methods

deprecate_from() click to toggle source
# File lib/automation_helpers/patches/selenium_options.rb, line 44
def deprecate_from
  '4.0.0.beta5'
end
description() click to toggle source
# File lib/automation_helpers/patches/selenium_options.rb, line 27
      def description
        <<~DESCRIPTION
          This patch fixes an issue with Selenium4 not camelising the browser_name property
          The issue is the driver, which is now fully W3C conformant expects `browserName`

          See: https://github.com/SeleniumHQ/selenium/pull/8834 for more details/discussion including this fix
          LH - Nov 2020
        DESCRIPTION
      end
gem_version() click to toggle source
# File lib/automation_helpers/patches/selenium_options.rb, line 52
def gem_version
  ::Selenium::WebDriver::VERSION
end
perform() click to toggle source
# File lib/automation_helpers/patches/selenium_options.rb, line 37
def perform
  case @browser
  when :firefox then ::Selenium::WebDriver::Firefox::Options.include CapabilitiesAsJsonFix
  when :safari then ::Selenium::WebDriver::Safari::Options.include CapabilitiesAsJsonFix
  end
end
prevent_usage_from() click to toggle source
# File lib/automation_helpers/patches/selenium_options.rb, line 48
def prevent_usage_from
  '4.0.1'
end
valid?() click to toggle source
# File lib/automation_helpers/patches/selenium_options.rb, line 23
def valid?
  %i[firefox safari].include?(@browser)
end