Class: Selenium::DevTools::V131::Security

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v131/security.rb

Constant Summary collapse

EVENTS =
{
  certificate_error: 'certificateError',
  visible_security_state_changed: 'visibleSecurityStateChanged',
  security_state_changed: 'securityStateChanged',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ Security

Returns a new instance of Security.



31
32
33
# File 'lib/selenium/devtools/v131/security.rb', line 31

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#disableObject



40
41
42
# File 'lib/selenium/devtools/v131/security.rb', line 40

def disable
  @devtools.send_cmd('Security.disable')
end

#enableObject



44
45
46
# File 'lib/selenium/devtools/v131/security.rb', line 44

def enable
  @devtools.send_cmd('Security.enable')
end

#handle_certificate_error(event_id:, action:) ⇒ Object



53
54
55
56
57
# File 'lib/selenium/devtools/v131/security.rb', line 53

def handle_certificate_error(event_id:, action:)
  @devtools.send_cmd('Security.handleCertificateError',
                     eventId: event_id,
                     action: action)
end

#on(event, &block) ⇒ Object



35
36
37
38
# File 'lib/selenium/devtools/v131/security.rb', line 35

def on(event, &block)
  event = EVENTS[event] if event.is_a?(Symbol)
  @devtools.callbacks["Security.#{event}"] << block
end

#set_ignore_certificate_errors(ignore:) ⇒ Object



48
49
50
51
# File 'lib/selenium/devtools/v131/security.rb', line 48

def set_ignore_certificate_errors(ignore:)
  @devtools.send_cmd('Security.setIgnoreCertificateErrors',
                     ignore: ignore)
end

#set_override_certificate_errors(override:) ⇒ Object



59
60
61
62
# File 'lib/selenium/devtools/v131/security.rb', line 59

def set_override_certificate_errors(override:)
  @devtools.send_cmd('Security.setOverrideCertificateErrors',
                     override: override)
end