Class: Selenium::WebDriver::Safari::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/webdriver/safari/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**opts) ⇒ Options

Create a new Options instance for W3C-capable versions of Safari.

Examples:

options = Selenium::WebDriver::Safari::Options.new(automatic_inspection: true)
driver = Selenium::WebDriver.for :safari, options: options

Parameters:

  • opts (Hash)

    the pre-defined options to create the Safari::Options with

Options Hash (**opts):

  • :automatic_inspection (Boolean)

    Preloads Web Inspector and JavaScript debugger. Default is false

  • :automatic_profiling (Boolean)

    Preloads Web Inspector and starts a timeline recording. Default is false

See Also:


40
41
42
43
# File 'lib/selenium/webdriver/safari/options.rb', line 40

def initialize(**opts)
  @automatic_inspection = opts.delete(:automatic_inspection) || false
  @automatic_profiling = opts.delete(:automatic_profiling) || false
end

Instance Attribute Details

#automatic_inspectionObject

Returns the value of attribute automatic_inspection


24
25
26
# File 'lib/selenium/webdriver/safari/options.rb', line 24

def automatic_inspection
  @automatic_inspection
end

#automatic_profilingObject

Returns the value of attribute automatic_profiling


24
25
26
# File 'lib/selenium/webdriver/safari/options.rb', line 24

def automatic_profiling
  @automatic_profiling
end

Instance Method Details

#as_jsonObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


49
50
51
52
53
54
55
56
# File 'lib/selenium/webdriver/safari/options.rb', line 49

def as_json(*)
  opts = {}

  opts['safari:automaticInspection'] = true if @automatic_inspection
  opts['safari:automaticProfiling'] = true if @automatic_profiling

  opts
end