class Selenium::WebDriver::IE::Options

Constants

CAPABILITIES
KEY
SCROLL_BOTTOM
SCROLL_TOP

Attributes

args[R]
options[R]

Public Class Methods

new(**opts) click to toggle source

Create a new Options instance

@example

options = Selenium::WebDriver::IE::Options.new(args: ['--host=127.0.0.1'])
driver = Selenium::WebDriver.for(:ie, options: options)

@example

options = Selenium::WebDriver::IE::Options.new
options.element_scroll_behavior = Selenium::WebDriver::IE::Options::SCROLL_BOTTOM
driver = Selenium::WebDriver.for(:ie, options: options)

@param [Hash] opts the pre-defined options @option opts [Array<String>] args @option opts [Integer] browser_attach_timeout @option opts [Integer] element_scroll_behavior Either SCROLL_TOP or SCROLL_BOTTOM @option opts [Boolean] full_page_screenshot @option opts [Boolean] ensure_clean_session @option opts [Integer] file_upload_dialog_timeout @option opts [Boolean] force_create_process_api @option opts [Boolean] force_shell_windows_api @option opts [Boolean] ignore_protected_mode_settings @option opts [Boolean] ignore_zoom_level @option opts [String] initial_browser_url @option opts [Boolean] native_events @option opts [Boolean] persistent_hover @option opts [Boolean] require_window_focus @option opts [Boolean] use_per_process_proxy @option opts [Boolean] validate_cookie_document_type

# File lib/selenium/webdriver/ie/options.rb, line 88
def initialize(**opts)
  @args = Set.new(opts.delete(:args) || [])
  @options = opts
  @options[:native_events] = true if @options[:native_events].nil?
end

Public Instance Methods

add_argument(arg) click to toggle source

Add a command-line argument to use when starting Internet Explorer.

@param [String] arg The command-line argument to add

# File lib/selenium/webdriver/ie/options.rb, line 100
def add_argument(arg)
  @args << arg
end
add_option(name, value) click to toggle source

Add a new option not yet handled by these bindings.

@example

options = Selenium::WebDriver::IE::Options.new
options.add_option(:foo, 'bar')

@param [String, Symbol] name Name of the option @param [Boolean, String, Integer] value Value of the option

# File lib/selenium/webdriver/ie/options.rb, line 115
def add_option(name, value)
  @options[name] = value
end
as_json(*) click to toggle source

@api private

# File lib/selenium/webdriver/ie/options.rb, line 123
def as_json(*)
  opts = {}

  CAPABILITIES.each do |capability_alias, capability_name|
    capability_value = @options.delete(capability_alias)
    opts[capability_name] = capability_value unless capability_value.nil?
  end
  opts['ie.browserCommandLineSwitches'] = @args.to_a.join(' ') if @args.any?
  opts.merge!(@options)

  {KEY => generate_as_json(opts)}
end