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

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

Constant Summary collapse

CAPABILITIES =
{automatic_inspection: 'safari:automaticInspection',
automatic_profiling: 'safari:automaticProfiling',
experimental_web_socket_url: 'safari:experimentalWebSocketUrl'}.freeze
BROWSER =
'safari'
TECHNOLOGY_PREVIEW =
'Safari Technology Preview'

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



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

def options
  @options
end

Instance Method Details

#add_option(name, value = nil) ⇒ Object

Raises:

  • (ArgumentError)


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

def add_option(name, value = nil)
  key = name.is_a?(Hash) ? name.keys.first : name
  raise ArgumentError, 'Safari does not support options that are not namespaced' unless key.to_s.include?(':')

  super
end

#browser_nameObject



44
45
46
# File 'lib/selenium/webdriver/safari/options.rb', line 44

def browser_name
  @options[:browser_name] = Safari.technology_preview? ? TECHNOLOGY_PREVIEW : BROWSER
end

#browser_name=(value) ⇒ Object



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

def browser_name=(value)
  @options[:browser_name] = value
end

#enable_bidi!Boolean

Enables WebDriver BiDi for Safari, which also requires the experimental capability, and warns that Safari's BiDi support is experimental.

Returns:

  • (Boolean)


55
56
57
58
59
60
# File 'lib/selenium/webdriver/safari/options.rb', line 55

def enable_bidi!
  super
  WebDriver.logger.warn("Safari's WebDriver BiDi support is experimental and may be incomplete",
                        id: :safari_bidi)
  @options[:experimental_web_socket_url] = true
end