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

Returns a new instance of Options.



8
9
10
11
# File 'lib/selenium/webdriver/safari/options.rb', line 8

def initialize(opts = {})
  @extensions = []
  extract_options(opts)
end

Instance Attribute Details

#data_dirObject

Returns the value of attribute data_dir.



5
6
7
# File 'lib/selenium/webdriver/safari/options.rb', line 5

def data_dir
  @data_dir
end

#extensionsObject (readonly)

Returns the value of attribute extensions.



6
7
8
# File 'lib/selenium/webdriver/safari/options.rb', line 6

def extensions
  @extensions
end

#portObject

Returns the value of attribute port.



5
6
7
# File 'lib/selenium/webdriver/safari/options.rb', line 5

def port
  @port
end

#skip_extension_installationObject

Returns the value of attribute skip_extension_installation.



5
6
7
# File 'lib/selenium/webdriver/safari/options.rb', line 5

def skip_extension_installation
  @skip_extension_installation
end

Instance Method Details

#add_extension(ext) ⇒ Object



13
14
15
# File 'lib/selenium/webdriver/safari/options.rb', line 13

def add_extension(ext)
  @extensions << verify_safari_extension(ext)
end

#as_jsonObject



32
33
34
35
36
37
38
39
40
# File 'lib/selenium/webdriver/safari/options.rb', line 32

def as_json
  {
    'port'                      => port,
    'dataDir'                   => data_dir,
    'cleanSession'              => clean_session?,
    'extensions'                => extensions_as_json,
    'skipExtensionInstallation' => skip_extension_installation?
  }
end

#clean_session?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/selenium/webdriver/safari/options.rb', line 17

def clean_session?
  !!@clean_session
end

#skip_extension_installation?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/selenium/webdriver/safari/options.rb', line 21

def skip_extension_installation?
  !!@skip_extension_installation
end

#to_capabilitiesObject



25
26
27
28
29
30
# File 'lib/selenium/webdriver/safari/options.rb', line 25

def to_capabilities
  caps = Remote::Capabilities.safari
  caps.merge!('safari.options' => as_json)

  caps
end